Skip to content

Commit

Permalink
Send openstack inventory logs to stderr (#51827)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding authored and abadger committed Feb 18, 2019
1 parent 7fb1549 commit b159fc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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
7 changes: 5 additions & 2 deletions 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

# TODO(mordred) Integrate shade's logging with ansible's logging
sdk.enable_logging()
# 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(stream=sys.stderr)

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

0 comments on commit b159fc3

Please sign in to comment.