Skip to content

Instantly share code, notes, and snippets.

@elyezer
Created August 29, 2017 13:55
Show Gist options
  • Save elyezer/8f1df81fd8d6b39ea390274991ccfe5e to your computer and use it in GitHub Desktop.
Save elyezer/8f1df81fd8d6b39ea390274991ccfe5e to your computer and use it in GitHub Desktop.
diff --git a/rho/scancommand.py b/rho/scancommand.py
index f222c92..7fe446e 100644
--- a/rho/scancommand.py
+++ b/rho/scancommand.py
@@ -491,13 +491,23 @@ class ScanCommand(CliCommand):
ansible_vars = {'facts_to_collect': self.facts_to_collect,
'report_path': report_path}
- playbook = utilities.PLAYBOOK_DEV_PATH
- if not os.path.isfile(playbook):
- playbook = utilities.PLAYBOOK_RPM_PATH
- if not os.path.isfile(playbook):
- print(_("rho scan playbook not found locally or in '%s'")
- % playbook)
- sys.exit(1)
+ playbook = None
+ paths = [
+ utilities.PLAYBOOK_DEV_PATH,
+ os.path.join(
+ sys.prefix, 'rho_ansible', utilities.PLAYBOOK_DEV_PATH),
+ utilities.PLAYBOOK_RPM_PATH,
+ ]
+ for path in paths:
+ if os.path.isfile(path):
+ playbook = path
+ break
+ if not playbook:
+ print(
+ _("rho scan playbook not found locally or in '%s'")
+ % ', '.join(paths)
+ )
+ sys.exit(1)
cmd_string = ('ansible-playbook {playbook} '
'-i data/{profile}_hosts.yml -f {forks} '
diff --git a/setup.py b/setup.py
index 7e3bfa3..0bd8d4b 100755
--- a/setup.py
+++ b/setup.py
@@ -85,9 +85,23 @@ def get_locale_paths():
return data_paths
+def get_rho_ansible_paths():
+ rho_ansible_path = 'rho_ansible'
+ data_paths = [
+ (rho_ansible_path, ['rho_playbook.yml']),
+ ]
+ for pattern in ('library/*', 'roles/*/tasks/*.yml'):
+ for path in glob.glob(pattern):
+ dirname = os.path.dirname(path)
+ data_paths.append(
+ (os.path.join(rho_ansible_path, dirname), glob.glob(pattern))
+ )
+ return data_paths
+
+
def get_data_files():
gen_mo_files()
- return get_locale_paths()
+ return get_locale_paths() + get_rho_ansible_paths()
setup(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment