diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2015-10-27 13:26:57 -0300 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2015-10-27 15:09:10 -0300 |
commit | 93b2a9bd2f4a3b93be3cb51ecf034000a652496e (patch) | |
tree | 4e943d1bf5792706e1408fcf4f5569938b4808f5 /utils/src | |
parent | 201fd2f37d43419513b448cd99dd202a96bb8542 (diff) | |
download | openshift-93b2a9bd2f4a3b93be3cb51ecf034000a652496e.tar.gz openshift-93b2a9bd2f4a3b93be3cb51ecf034000a652496e.tar.bz2 openshift-93b2a9bd2f4a3b93be3cb51ecf034000a652496e.tar.xz openshift-93b2a9bd2f4a3b93be3cb51ecf034000a652496e.zip |
Use default playbooks if available.
Because we're now installing from an rpm, we have a good idea where to find the
default playbooks and shouldn't require the user to tell us.
Diffstat (limited to 'utils/src')
-rw-r--r-- | utils/src/ooinstall/cli_installer.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 91d501952..03f86a166 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -12,6 +12,7 @@ from ooinstall.oo_config import Host from ooinstall.variants import find_variant, get_variant_version_combos DEFAULT_ANSIBLE_CONFIG = '/usr/share/atomic-openshift-util/ansible.cfg' +DEFAULT_PLAYBOOK_DIR = '/usr/share/ansible/openshift-ansible/' def validate_ansible_dir(path): if not path: @@ -382,7 +383,7 @@ def get_hosts_to_run_on(oo_cfg, callback_facts, unattended, force): type=click.Path(exists=True, file_okay=False, dir_okay=True, - writable=True, + writable=False, readable=True), # callback=validate_ansible_dir, envvar='OO_ANSIBLE_PLAYBOOK_DIRECTORY') @@ -408,15 +409,21 @@ def cli(ctx, unattended, configuration, ansible_playbook_directory, ansible_conf ctx.obj = {} ctx.obj['unattended'] = unattended ctx.obj['configuration'] = configuration - ctx.obj['ansible_playbook_directory'] = ansible_playbook_directory ctx.obj['ansible_config'] = ansible_config ctx.obj['ansible_log_path'] = ansible_log_path oo_cfg = OOConfig(ctx.obj['configuration']) - ansible_playbook_directory = ctx.obj['ansible_playbook_directory'] + # If no playbook dir on the CLI, check the config: if not ansible_playbook_directory: ansible_playbook_directory = oo_cfg.settings.get('ansible_playbook_directory', '') + # If still no playbook dir, check for the default location: + if not ansible_playbook_directory and os.path.exists(DEFAULT_PLAYBOOK_DIR): + ansible_playbook_directory = DEFAULT_PLAYBOOK_DIR + validate_ansible_dir(ansible_playbook_directory) + oo_cfg.settings['ansible_playbook_directory'] = ansible_playbook_directory + oo_cfg.ansible_playbook_directory = ansible_playbook_directory + ctx.obj['ansible_playbook_directory'] = ansible_playbook_directory if ctx.obj['ansible_config']: oo_cfg.settings['ansible_config'] = ctx.obj['ansible_config'] @@ -424,10 +431,6 @@ def cli(ctx, unattended, configuration, ansible_playbook_directory, ansible_conf # If we're installed by RPM this file should exist and we can use it as our default: oo_cfg.settings['ansible_config'] = DEFAULT_ANSIBLE_CONFIG - validate_ansible_dir(ansible_playbook_directory) - oo_cfg.settings['ansible_playbook_directory'] = ansible_playbook_directory - oo_cfg.ansible_playbook_directory = ansible_playbook_directory - oo_cfg.settings['ansible_log_path'] = ctx.obj['ansible_log_path'] ctx.obj['oo_cfg'] = oo_cfg |