summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/src/ooinstall/cli_installer.py23
-rw-r--r--utils/src/ooinstall/oo_config.py9
-rw-r--r--utils/src/ooinstall/openshift_ansible.py6
-rw-r--r--utils/test/cli_installer_tests.py13
-rw-r--r--utils/test/oo_config_tests.py22
5 files changed, 45 insertions, 28 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py
index a40ff5cfc..6cdc19f20 100644
--- a/utils/src/ooinstall/cli_installer.py
+++ b/utils/src/ooinstall/cli_installer.py
@@ -11,7 +11,7 @@ from ooinstall import OOConfig
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_ANSIBLE_CONFIG = '/usr/share/atomic-openshift-utils/ansible.cfg'
DEFAULT_PLAYBOOK_DIR = '/usr/share/ansible/openshift-ansible/'
def validate_ansible_dir(path):
@@ -112,13 +112,15 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen
host_props['master'] = click.confirm('Will this host be an OpenShift Master?')
host_props['node'] = True
- rpm_or_container = click.prompt('Will this host be RPM or Container based (rpm/container)?',
- type=click.Choice(['rpm', 'container']),
- default='rpm')
- if rpm_or_container == 'container':
- host_props['containerized'] = True
- else:
- host_props['containerized'] = False
+ #TODO: Reenable this option once container installs are out of tech preview
+ #rpm_or_container = click.prompt('Will this host be RPM or Container based (rpm/container)?',
+ # type=click.Choice(['rpm', 'container']),
+ # default='rpm')
+ #if rpm_or_container == 'container':
+ # host_props['containerized'] = True
+ #else:
+ # host_props['containerized'] = False
+ host_props['containerized'] = False
host = Host(**host_props)
@@ -175,7 +177,8 @@ Notes:
h.public_ip,
h.hostname,
h.public_hostname]))
- output = "%s\n%s" % (output, ",".join([h.ip,
+ output = "%s\n%s" % (output, ",".join([h.connect_to,
+ h.ip,
h.public_ip,
h.hostname,
h.public_hostname]))
@@ -491,7 +494,7 @@ def upgrade(ctx):
verbose = ctx.obj['verbose']
if len(oo_cfg.hosts) == 0:
- click.echo("No hosts defined in: %s" % oo_cfg['configuration'])
+ click.echo("No hosts defined in: %s" % oo_cfg.config_path)
sys.exit(1)
# Update config to reflect the version we're targetting, we'll write
diff --git a/utils/src/ooinstall/oo_config.py b/utils/src/ooinstall/oo_config.py
index f35a8f51b..9c97e6e93 100644
--- a/utils/src/ooinstall/oo_config.py
+++ b/utils/src/ooinstall/oo_config.py
@@ -116,8 +116,12 @@ class OOConfig(object):
def _upgrade_legacy_config(self):
new_hosts = []
+ remove_settings = ['validated_facts', 'Description', 'Name',
+ 'Subscription', 'Vendor', 'Version', 'masters', 'nodes']
+
if 'validated_facts' in self.settings:
for key, value in self.settings['validated_facts'].iteritems():
+ value['connect_to'] = key
if 'masters' in self.settings and key in self.settings['masters']:
value['master'] = True
if 'nodes' in self.settings and key in self.settings['nodes']:
@@ -125,10 +129,9 @@ class OOConfig(object):
new_hosts.append(value)
self.settings['hosts'] = new_hosts
- remove_settings = ['validated_facts', 'Description', 'Name',
- 'Subscription', 'Vendor', 'Version', 'masters', 'nodes']
for s in remove_settings:
- del self.settings[s]
+ if s in self.settings:
+ del self.settings[s]
# A legacy config implies openshift-enterprise 3.0:
self.settings['variant'] = 'openshift-enterprise'
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py
index bac4951d5..e4c808e85 100644
--- a/utils/src/ooinstall/openshift_ansible.py
+++ b/utils/src/ooinstall/openshift_ansible.py
@@ -127,7 +127,7 @@ def default_facts(hosts, verbose=False):
def run_main_playbook(hosts, hosts_to_run_on, verbose=False):
global CFG
- inventory_file = generate_inventory(hosts)
+ inventory_file = generate_inventory(hosts_to_run_on)
if len(hosts_to_run_on) != len(hosts):
main_playbook_path = os.path.join(CFG.ansible_playbook_directory,
'playbooks/common/openshift-cluster/scaleup.yml')
@@ -164,8 +164,10 @@ def run_uninstall_playbook(verbose=False):
def run_upgrade_playbook(verbose=False):
+ # TODO: do not hardcode the upgrade playbook, add ability to select the
+ # right playbook depending on the type of upgrade.
playbook = os.path.join(CFG.settings['ansible_playbook_directory'],
- 'playbooks/adhoc/upgrades/upgrade.yml')
+ 'playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml')
# TODO: Upgrade inventory for upgrade?
inventory_file = generate_inventory(CFG.hosts)
facts_env = os.environ.copy()
diff --git a/utils/test/cli_installer_tests.py b/utils/test/cli_installer_tests.py
index b183f0acb..d58539b18 100644
--- a/utils/test/cli_installer_tests.py
+++ b/utils/test/cli_installer_tests.py
@@ -46,18 +46,21 @@ SAMPLE_CONFIG = """
variant: %s
ansible_ssh_user: root
hosts:
- - ip: 10.0.0.1
+ - connect_to: master-private.example.com
+ ip: 10.0.0.1
hostname: master-private.example.com
public_ip: 24.222.0.1
public_hostname: master.example.com
master: true
node: true
- - ip: 10.0.0.2
+ - connect_to: node1-private.example.com
+ ip: 10.0.0.2
hostname: node1-private.example.com
public_ip: 24.222.0.2
public_hostname: node1.example.com
node: true
- - ip: 10.0.0.3
+ - connect_to: node2-private.example.com
+ ip: 10.0.0.3
hostname: node2-private.example.com
public_ip: 24.222.0.3
public_hostname: node2.example.com
@@ -329,7 +332,7 @@ class AttendedCliTests(OOCliFixture):
for (host, is_master) in hosts:
inputs.append(host)
inputs.append('y' if is_master else 'n')
- inputs.append('rpm')
+ #inputs.append('rpm')
if i < len(hosts) - 1:
inputs.append('y') # Add more hosts
else:
@@ -346,7 +349,7 @@ class AttendedCliTests(OOCliFixture):
for (host, is_master) in add_nodes:
inputs.append(host)
inputs.append('y' if is_master else 'n')
- inputs.append('rpm')
+ #inputs.append('rpm')
if i < len(add_nodes) - 1:
inputs.append('y') # Add more hosts
else:
diff --git a/utils/test/oo_config_tests.py b/utils/test/oo_config_tests.py
index 6dc335a0e..0dd4a30e9 100644
--- a/utils/test/oo_config_tests.py
+++ b/utils/test/oo_config_tests.py
@@ -14,18 +14,21 @@ SAMPLE_CONFIG = """
variant: openshift-enterprise
ansible_ssh_user: root
hosts:
- - ip: 10.0.0.1
+ - connect_to: master-private.example.com
+ ip: 10.0.0.1
hostname: master-private.example.com
public_ip: 24.222.0.1
public_hostname: master.example.com
master: true
node: true
- - ip: 10.0.0.2
+ - connect_to: node1-private.example.com
+ ip: 10.0.0.2
hostname: node1-private.example.com
public_ip: 24.222.0.2
public_hostname: node1.example.com
node: true
- - ip: 10.0.0.3
+ - connect_to: node2-private.example.com
+ ip: 10.0.0.3
hostname: node2-private.example.com
public_ip: 24.222.0.3
public_hostname: node2.example.com
@@ -54,16 +57,19 @@ validated_facts:
CONFIG_INCOMPLETE_FACTS = """
hosts:
- - ip: 10.0.0.1
+ - connect_to: 10.0.0.1
+ ip: 10.0.0.1
hostname: master-private.example.com
public_ip: 24.222.0.1
public_hostname: master.example.com
master: true
- - ip: 10.0.0.2
- hostname: node1-private.example.com
+ - connect_to: 10.0.0.2
+ ip: 10.0.0.2
+ hostname: 24.222.0.2
public_ip: 24.222.0.2
node: true
- - ip: 10.0.0.3
+ - connect_to: 10.0.0.3
+ ip: 10.0.0.3
node: true
"""
@@ -145,7 +151,7 @@ class OOConfigTests(OOInstallFixture):
ooconfig = OOConfig(cfg_path)
self.assertEquals(3, len(ooconfig.hosts))
- self.assertEquals("10.0.0.1", ooconfig.hosts[0].name)
+ self.assertEquals("master-private.example.com", ooconfig.hosts[0].connect_to)
self.assertEquals("10.0.0.1", ooconfig.hosts[0].ip)
self.assertEquals("master-private.example.com", ooconfig.hosts[0].hostname)