summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2016-03-24 08:51:01 -0300
committerDevan Goodwin <dgoodwin@redhat.com>2016-03-24 09:07:34 -0300
commit67d4685ef8885ff3ee759f5a36d9c97ba2012c50 (patch)
treefbb95c94f6197681cb24279f2ca782d01c90f403 /utils
parentb1479e0f4c2ded50fc68a435b6271a5acbec10e4 (diff)
downloadopenshift-67d4685ef8885ff3ee759f5a36d9c97ba2012c50.tar.gz
openshift-67d4685ef8885ff3ee759f5a36d9c97ba2012c50.tar.bz2
openshift-67d4685ef8885ff3ee759f5a36d9c97ba2012c50.tar.xz
openshift-67d4685ef8885ff3ee759f5a36d9c97ba2012c50.zip
Write inventory to same directory as quick install config.
With the addition of a --gen-inventory flag and always displaying the location of the inventory written to disk, we should write the hosts file to a more prominent location rather than a hidden directory.
Diffstat (limited to 'utils')
-rw-r--r--utils/src/ooinstall/oo_config.py2
-rw-r--r--utils/test/cli_installer_tests.py18
-rw-r--r--utils/test/fixture.py2
3 files changed, 11 insertions, 11 deletions
diff --git a/utils/src/ooinstall/oo_config.py b/utils/src/ooinstall/oo_config.py
index c9498542f..0f1f5caf7 100644
--- a/utils/src/ooinstall/oo_config.py
+++ b/utils/src/ooinstall/oo_config.py
@@ -198,7 +198,7 @@ class OOConfig(object):
self.settings['ansible_ssh_user'] = ''
self.settings['ansible_inventory_path'] = \
- '{}/hosts'.format(self.settings['ansible_inventory_directory'])
+ '{}/hosts'.format(os.path.dirname(self.config_path))
# clean up any empty sets
for setting in self.settings.keys():
diff --git a/utils/test/cli_installer_tests.py b/utils/test/cli_installer_tests.py
index 00136f0c8..7a621e637 100644
--- a/utils/test/cli_installer_tests.py
+++ b/utils/test/cli_installer_tests.py
@@ -403,7 +403,7 @@ class UnattendedCliTests(OOCliFixture):
self.assert_result(result, 0)
load_facts_args = load_facts_mock.call_args[0]
- self.assertEquals(os.path.join(self.work_dir, ".ansible/hosts"),
+ self.assertEquals(os.path.join(self.work_dir, "hosts"),
load_facts_args[0])
self.assertEquals(os.path.join(self.work_dir,
"playbooks/byo/openshift_facts.yml"), load_facts_args[1])
@@ -441,7 +441,7 @@ class UnattendedCliTests(OOCliFixture):
# Check the inventory file looks as we would expect:
inventory = ConfigParser.ConfigParser(allow_no_value=True)
- inventory.read(os.path.join(self.work_dir, '.ansible/hosts'))
+ inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assertEquals('bob',
inventory.get('OSEv3:vars', 'ansible_ssh_user'))
self.assertEquals('openshift-enterprise',
@@ -484,7 +484,7 @@ class UnattendedCliTests(OOCliFixture):
# Make sure the correct value was passed to ansible:
inventory = ConfigParser.ConfigParser(allow_no_value=True)
- inventory.read(os.path.join(self.work_dir, '.ansible/hosts'))
+ inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assertEquals('openshift-enterprise',
inventory.get('OSEv3:vars', 'deployment_type'))
@@ -512,7 +512,7 @@ class UnattendedCliTests(OOCliFixture):
self.assertEquals('3.0', written_config['variant_version'])
inventory = ConfigParser.ConfigParser(allow_no_value=True)
- inventory.read(os.path.join(self.work_dir, '.ansible/hosts'))
+ inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assertEquals('enterprise',
inventory.get('OSEv3:vars', 'deployment_type'))
@@ -733,7 +733,7 @@ class AttendedCliTests(OOCliFixture):
self._verify_config_hosts(written_config, 3)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
- inventory.read(os.path.join(self.work_dir, '.ansible/hosts'))
+ inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.1',
'openshift_schedulable=False')
self.assert_inventory_host_var_unset(inventory, 'nodes', '10.0.0.2',
@@ -851,7 +851,7 @@ class AttendedCliTests(OOCliFixture):
self._verify_config_hosts(written_config, 6)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
- inventory.read(os.path.join(self.work_dir, '.ansible/hosts'))
+ inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.1',
'openshift_schedulable=False')
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.2',
@@ -892,7 +892,7 @@ class AttendedCliTests(OOCliFixture):
self._verify_config_hosts(written_config, 5)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
- inventory.read(os.path.join(self.work_dir, '.ansible/hosts'))
+ inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.1',
'openshift_schedulable=True')
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.2',
@@ -983,7 +983,7 @@ class AttendedCliTests(OOCliFixture):
self._verify_config_hosts(written_config, 1)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
- inventory.read(os.path.join(self.work_dir, '.ansible/hosts'))
+ inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.1',
'openshift_schedulable=True')
@@ -1034,7 +1034,7 @@ class AttendedCliTests(OOCliFixture):
self._verify_config_hosts(written_config, 3)
inventory = ConfigParser.ConfigParser(allow_no_value=True)
- inventory.read(os.path.join(self.work_dir, '.ansible/hosts'))
+ inventory.read(os.path.join(self.work_dir, 'hosts'))
self.assert_inventory_host_var(inventory, 'nodes', '10.0.0.1',
'openshift_schedulable=False')
self.assert_inventory_host_var_unset(inventory, 'nodes', '10.0.0.2',
diff --git a/utils/test/fixture.py b/utils/test/fixture.py
index eb94418c2..1657d8f46 100644
--- a/utils/test/fixture.py
+++ b/utils/test/fixture.py
@@ -68,7 +68,7 @@ class OOCliFixture(OOInstallFixture):
def _verify_load_facts(self, load_facts_mock):
""" Check that we ran load facts with expected inputs. """
load_facts_args = load_facts_mock.call_args[0]
- self.assertEquals(os.path.join(self.work_dir, ".ansible/hosts"),
+ self.assertEquals(os.path.join(self.work_dir, "hosts"),
load_facts_args[0])
self.assertEquals(os.path.join(self.work_dir,
"playbooks/byo/openshift_facts.yml"),