소스 검색

aoi: Ask for osm_default_subdomain in interactive mode

Add a question to ask the user for a default subdomain.
Samuel Munilla 9 년 전
부모
커밋
0e18d1c290
4개의 변경된 파일21개의 추가작업 그리고 1개의 파일을 삭제
  1. 13 0
      utils/src/ooinstall/cli_installer.py
  2. 3 0
      utils/src/ooinstall/openshift_ansible.py
  3. 2 0
      utils/test/cli_installer_tests.py
  4. 3 1
      utils/test/fixture.py

+ 13 - 0
utils/src/ooinstall/cli_installer.py

@@ -45,6 +45,15 @@ passwordless sudo access.
     click.echo(message)
     return click.prompt('User for ssh access', default='root')
 
+def get_master_routingconfig_subdomain():
+    click.clear()
+    message = """
+You might want to override the default subdomain uses for exposed routes. If you don't know what
+this is, use the default value.
+"""
+    click.echo(message)
+    return click.prompt('New default subdomain (ENTER for none)', default='')
+
 def list_hosts(hosts):
     hosts_idx = range(len(hosts))
     for idx in hosts_idx:
@@ -498,6 +507,10 @@ https://docs.openshift.com/enterprise/latest/admin_guide/install/prerequisites.h
         oo_cfg.hosts = collect_hosts(oo_cfg)
         click.clear()
 
+    if not oo_cfg.settings.get('master_routingconfig_subdomain', None):
+        oo_cfg.settings['master_routingconfig_subdomain'] = get_master_routingconfig_subdomain()
+        click.clear()
+
     return oo_cfg
 
 

+ 3 - 0
utils/src/ooinstall/openshift_ansible.py

@@ -114,6 +114,9 @@ def write_inventory_vars(base_inventory, multiple_masters, proxy):
         base_inventory.write('openshift_master_cluster_method=native\n')
         base_inventory.write("openshift_master_cluster_hostname={}\n".format(proxy.hostname))
         base_inventory.write("openshift_master_cluster_public_hostname={}\n".format(proxy.public_hostname))
+    if CFG.settings['master_routingconfig_subdomain']:
+        base_inventory.write("osm_default_subdomain={}\n".format(CFG.settings['master_routingconfig_subdomain']))
+
 
 
 def write_host(host, inventory, schedulable=None):

+ 2 - 0
utils/test/cli_installer_tests.py

@@ -102,6 +102,7 @@ hosts:
 QUICKHA_CONFIG = """
 variant: %s
 ansible_ssh_user: root
+master_routingconfig_subdomain: example.com
 hosts:
   - connect_to: 10.0.0.1
     ip: 10.0.0.1
@@ -228,6 +229,7 @@ hosts:
 QUICKHA_CONFIG_PRECONFIGURED_LB = """
 variant: %s
 ansible_ssh_user: root
+master_routingconfig_subdomain: example.com
 hosts:
   - connect_to: 10.0.0.1
     ip: 10.0.0.1

+ 3 - 1
utils/test/fixture.py

@@ -11,6 +11,7 @@ from click.testing import CliRunner
 SAMPLE_CONFIG = """
 variant: %s
 ansible_ssh_user: root
+master_routingconfig_subdomain: example.com
 hosts:
   - connect_to: 10.0.0.1
     ip: 10.0.0.1
@@ -196,6 +197,8 @@ def build_input(ssh_user=None, hosts=None, variant_num=None,
             inputs.append(master_lb[0])
         inputs.append('y' if master_lb[1] else 'n')
 
+    inputs.append('example.com')
+
     # TODO: support option 2, fresh install
     if add_nodes:
         if schedulable_masters_ok:
@@ -228,4 +231,3 @@ def build_input(ssh_user=None, hosts=None, variant_num=None,
     ])
 
     return '\n'.join(inputs)
-