1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

infoblox inventory script: Use stderr, and allow use of environment for config (#436) (#1183)

* Use stderr, and allow use of environment for config

Originally from https://github.com/ansible/ansible/pull/49685

* Create 436-infoblox-use-stderr-and-environment-for-config.yaml

* Update changelogs/fragments/436-infoblox-use-stderr-and-environment-for-config.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update scripts/inventory/infoblox.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit c776387daa)

Co-authored-by: Jason Lingohr <lingfish@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2020-10-27 06:11:43 +01:00 committed by GitHub
parent c4e93b0b5f
commit 176c9a90ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- infoblox inventory script - use stderr for reporting errors, and allow use of environment for configuration (https://github.com/ansible-collections/community.general/pull/436).

View file

@ -20,6 +20,7 @@ from ansible_collections.community.general.plugins.module_utils.net_tools.nios.a
CONFIG_FILES = [
os.environ.get('INFOBLOX_CONFIG_FILE', ''),
'/etc/ansible/infoblox.yaml',
'/etc/ansible/infoblox.yml'
]
@ -44,7 +45,7 @@ def main():
if os.path.exists(config_file):
break
else:
sys.stdout.write('unable to locate config file at /etc/ansible/infoblox.yaml\n')
sys.stderr.write('unable to locate config file at /etc/ansible/infoblox.yaml\n')
sys.exit(-1)
try:
@ -53,7 +54,7 @@ def main():
provider = config.get('provider') or {}
wapi = WapiInventory(provider)
except Exception as exc:
sys.stdout.write(to_text(exc))
sys.stderr.write(to_text(exc))
sys.exit(-1)
if args.host: