Skip to content

Commit

Permalink
Send openstack inventory logs to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Feb 6, 2019
1 parent f9f7b29 commit 6d789b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/51827-openstack_logs_to_stderr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- openstack inventory plugin - send logs from sdk to stderr so they do not combine with output
5 changes: 4 additions & 1 deletion lib/ansible/plugins/inventory/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
'''

import collections
import sys

from ansible.errors import AnsibleParserError
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
Expand Down Expand Up @@ -172,8 +173,10 @@ def parse(self, inventory, loader, path, cache=True):
else:
config_files = None

# Redict logging to stderr so it does not mix with output
# particular ansible-inventory JSON output
# TODO(mordred) Integrate openstack's logging with ansible's logging
sdk.enable_logging()
sdk.enable_logging(stream=sys.stderr)

cloud_inventory = sdk_inventory.OpenStackInventory(
config_files=config_files,
Expand Down

0 comments on commit 6d789b9

Please sign in to comment.