Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
On cli startup, log a info line with basic info
Browse files Browse the repository at this point in the history
And 'info' level log the exit code.

For ex:

[2019-05-30 11:17:51,249 28223 I] ansible_galaxy_cli.cli.galaxy run:236 - \
  exe="/home/adrian/venvs/mazer040test/bin/mazer" version=0.5.0 \
  config_file="/home/adrian/.ansible/mazer.yml" \
  collections_path="/home/adrian/.ansible/collections" \
  server=http://localhost:8000 action=install

Fixes ansible#267
  • Loading branch information
alikins committed May 30, 2019
1 parent d44748a commit b387373
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ansible_galaxy_cli/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ def run(self):
log.debug('self.args: %s', self.args)

if self.config_file_path:
log.info(u"Using %s as config file", to_text(self.config_file_path))
log.debug(u"Using %s as config file", to_text(self.config_file_path))
else:
log.info(u"No config file found; using defaults")
log.debug(u"No config file found; using defaults")

def validate_conflicts(self, vault_opts=False, runas_opts=False, fork_opts=False, vault_rekey_opts=False):
''' check for conflicting options '''
Expand Down
14 changes: 13 additions & 1 deletion ansible_galaxy_cli/cli/galaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

from ansible_galaxy import matchers
from ansible_galaxy import rest_api
from ansible_galaxy import mazer_version

from ansible_galaxy.models.context import GalaxyContext
from ansible_galaxy.models.build_context import BuildContext
Expand Down Expand Up @@ -219,10 +220,21 @@ def run(self):

log.debug('galaxy context: %s', galaxy_context)

log.debug('execute action: %s', self.action)
log.debug('execute action with options: %s', self.options)
log.debug('execute action with args: %s', self.args)

version_info = mazer_version.version_data(config_file_path=self.config_file_path,
cli_version=galaxy_cli_version,
argv=sys.argv)

log.info('exe="%s" version=%s config_file="%s" collections_path="%s" server=%s action=%s',
version_info['executable_location'],
version_info['version'],
version_info['config_file'],
galaxy_context.collections_path,
galaxy_context.server['url'],
self.action)

return self.execute()

def execute_build(self):
Expand Down
2 changes: 1 addition & 1 deletion ansible_galaxy_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ def main(args=None):
log.error('Uncaught exception, existing with exit code: %s', exit_code)
raise

log.debug('exit code: %s', exit_code)
log.info('exit code: %s', exit_code)
# do any return code setup we need here
return exit_code

0 comments on commit b387373

Please sign in to comment.