summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apex/deploy.py6
-rw-r--r--apex/overcloud/deploy.py15
-rw-r--r--apex/tests/test_apex_overcloud_deploy.py17
-rw-r--r--apex/undercloud/undercloud.py3
-rw-r--r--config/network/network_settings.yaml4
-rw-r--r--config/network/network_settings_v6.yaml4
-rw-r--r--config/network/network_settings_vlans.yaml4
-rw-r--r--config/network/network_settings_vpp.yaml4
-rw-r--r--lib/ansible/playbooks/configure_undercloud.yml12
9 files changed, 60 insertions, 9 deletions
diff --git a/apex/deploy.py b/apex/deploy.py
index 5171c5c..fe25634 100644
--- a/apex/deploy.py
+++ b/apex/deploy.py
@@ -411,8 +411,8 @@ def main():
if not upstream:
oc_deploy.prep_env(deploy_settings, net_settings, inventory,
opnfv_env, net_env_target, APEX_TEMP_DIR)
- oc_deploy.prep_image(deploy_settings, sdn_image, APEX_TEMP_DIR,
- root_pw=root_pw)
+ oc_deploy.prep_image(deploy_settings, net_settings, sdn_image,
+ APEX_TEMP_DIR, root_pw=root_pw)
else:
shutil.copyfile(sdn_image, os.path.join(APEX_TEMP_DIR,
'overcloud-full.qcow2'))
@@ -449,6 +449,8 @@ def main():
deploy_vars['overcloudrc'] = 'source /home/stack/overcloudrc'
deploy_vars['upstream'] = upstream
deploy_vars['os_version'] = os_version
+ deploy_vars['http_proxy'] = net_settings.get('http_proxy', '')
+ deploy_vars['https_proxy'] = net_settings.get('https_proxy', '')
for dns_server in net_settings['dns_servers']:
deploy_vars['dns_server_args'] += " --dns-nameserver {}".format(
dns_server)
diff --git a/apex/overcloud/deploy.py b/apex/overcloud/deploy.py
index 19d46e1..5bbcaed 100644
--- a/apex/overcloud/deploy.py
+++ b/apex/overcloud/deploy.py
@@ -186,10 +186,11 @@ def create_deploy_cmd(ds, ns, inv, tmp_dir,
return cmd
-def prep_image(ds, img, tmp_dir, root_pw=None):
+def prep_image(ds, ns, img, tmp_dir, root_pw=None):
"""
Locates sdn image and preps for deployment.
:param ds: deploy settings
+ :param ns: network settings
:param img: sdn image
:param tmp_dir: dir to store modified sdn image
:param root_pw: password to configure for overcloud image
@@ -219,6 +220,18 @@ def prep_image(ds, img, tmp_dir, root_pw=None):
".service"
}])
+ if ns.get('http_proxy', ''):
+ virt_cmds.append({
+ con.VIRT_RUN_CMD:
+ "echo 'http_proxy={}' >> /etc/environment".format(
+ ns['http_proxy'])})
+
+ if ns.get('https_proxy', ''):
+ virt_cmds.append({
+ con.VIRT_RUN_CMD:
+ "echo 'https_proxy={}' >> /etc/environment".format(
+ ns['https_proxy'])})
+
if ds_opts['vpn']:
virt_cmds.append({con.VIRT_RUN_CMD: "chmod +x /etc/rc.d/rc.local"})
virt_cmds.append({
diff --git a/apex/tests/test_apex_overcloud_deploy.py b/apex/tests/test_apex_overcloud_deploy.py
index 8ff98a8..420a70d 100644
--- a/apex/tests/test_apex_overcloud_deploy.py
+++ b/apex/tests/test_apex_overcloud_deploy.py
@@ -154,7 +154,8 @@ class TestOvercloudDeploy(unittest.TestCase):
'global_params': MagicMock()}
ds['deploy_options'].__getitem__.side_effect = \
lambda i: ds_opts.get(i, MagicMock())
- prep_image(ds, 'undercloud.qcow2', '/tmp', root_pw='test')
+ ns = MagicMock()
+ prep_image(ds, ns, 'undercloud.qcow2', '/tmp', root_pw='test')
mock_virt_utils.virt_customize.assert_called()
@patch('apex.overcloud.deploy.virt_utils')
@@ -169,7 +170,8 @@ class TestOvercloudDeploy(unittest.TestCase):
'global_params': MagicMock()}
ds['deploy_options'].__getitem__.side_effect = \
lambda i: ds_opts.get(i, MagicMock())
- prep_image(ds, 'undercloud.qcow2', '/tmp', root_pw='test')
+ ns = MagicMock()
+ prep_image(ds, ns, 'undercloud.qcow2', '/tmp', root_pw='test')
mock_virt_utils.virt_customize.assert_called()
@patch('apex.overcloud.deploy.virt_utils')
@@ -188,7 +190,8 @@ class TestOvercloudDeploy(unittest.TestCase):
lambda i: ds_opts.get(i, MagicMock())
ds['deploy_options'].__contains__.side_effect = \
lambda i: True if i in ds_opts else MagicMock()
- prep_image(ds, 'undercloud.qcow2', '/tmp', root_pw='test')
+ ns = MagicMock()
+ prep_image(ds, ns, 'undercloud.qcow2', '/tmp', root_pw='test')
mock_virt_utils.virt_customize.assert_called()
@patch('apex.overcloud.deploy.virt_utils')
@@ -204,7 +207,8 @@ class TestOvercloudDeploy(unittest.TestCase):
'global_params': MagicMock()}
ds['deploy_options'].__getitem__.side_effect = \
lambda i: ds_opts.get(i, MagicMock())
- prep_image(ds, 'undercloud.qcow2', '/tmp', root_pw='test')
+ ns = MagicMock()
+ prep_image(ds, ns, 'undercloud.qcow2', '/tmp', root_pw='test')
mock_virt_utils.virt_customize.assert_called()
@patch('apex.overcloud.deploy.virt_utils')
@@ -219,14 +223,15 @@ class TestOvercloudDeploy(unittest.TestCase):
'global_params': MagicMock()}
ds['deploy_options'].__getitem__.side_effect = \
lambda i: ds_opts.get(i, MagicMock())
- prep_image(ds, 'undercloud.qcow2', '/tmp', root_pw='test')
+ ns = MagicMock()
+ prep_image(ds, ns, 'undercloud.qcow2', '/tmp', root_pw='test')
mock_virt_utils.virt_customize.assert_called()
@patch('apex.overcloud.deploy.os.path.isfile')
def test_prep_image_no_image(self, mock_isfile):
mock_isfile.return_value = False
assert_raises(ApexDeployException, prep_image,
- {}, 'undercloud.qcow2', '/tmp')
+ {}, {}, 'undercloud.qcow2', '/tmp')
def test_make_ssh_key(self):
priv, pub = make_ssh_key()
diff --git a/apex/undercloud/undercloud.py b/apex/undercloud/undercloud.py
index d28ed98..63f9183 100644
--- a/apex/undercloud/undercloud.py
+++ b/apex/undercloud/undercloud.py
@@ -236,4 +236,7 @@ class Undercloud:
"enabled": ns_external['enabled']
}
+ config['http_proxy'] = ns.get('http_proxy', '')
+ config['https_proxy'] = ns.get('https_proxy', '')
+
return config
diff --git a/config/network/network_settings.yaml b/config/network/network_settings.yaml
index fe11a9b..ffe3a18 100644
--- a/config/network/network_settings.yaml
+++ b/config/network/network_settings.yaml
@@ -57,6 +57,10 @@ syslog:
server: 10.128.1.24
transport: 'tcp'
+# http(s) proxy settings added to /etc/environment of uc and oc nodes
+# http_proxy: http://proxy.server:8080
+# https_proxy: https://proxy.server:8081
+
# Common network settings
networks:
# Admin configuration (pxe and jumpstart)
diff --git a/config/network/network_settings_v6.yaml b/config/network/network_settings_v6.yaml
index 7dddf34..176bc7c 100644
--- a/config/network/network_settings_v6.yaml
+++ b/config/network/network_settings_v6.yaml
@@ -57,6 +57,10 @@ syslog:
server: 10.128.1.24
transport: 'tcp'
+# http(s) proxy settings added to /etc/environment of uc and oc nodes
+# http_proxy: http://proxy.server:8080
+# https_proxy: https://proxy.server:8081
+
# Common network settings
networks:
# Admin configuration (pxe and jumpstart)
diff --git a/config/network/network_settings_vlans.yaml b/config/network/network_settings_vlans.yaml
index 345dbbd..29cd193 100644
--- a/config/network/network_settings_vlans.yaml
+++ b/config/network/network_settings_vlans.yaml
@@ -57,6 +57,10 @@ syslog:
server: 10.128.1.24
transport: 'tcp'
+# http(s) proxy settings added to /etc/environment of uc and oc nodes
+# http_proxy: http://proxy.server:8080
+# https_proxy: https://proxy.server:8081
+
# Common network settings
networks:
# Admin configuration (pxe and jumpstart)
diff --git a/config/network/network_settings_vpp.yaml b/config/network/network_settings_vpp.yaml
index 2f6bba5..a40158e 100644
--- a/config/network/network_settings_vpp.yaml
+++ b/config/network/network_settings_vpp.yaml
@@ -57,6 +57,10 @@ syslog:
server: 10.128.1.24
transport: 'tcp'
+# http(s) proxy settings added to /etc/environment of uc and oc nodes
+# http_proxy: http://proxy.server:8080
+# https_proxy: https://proxy.server:8081
+
# Common network settings
networks:
# Admin configuration (pxe and jumpstart)
diff --git a/lib/ansible/playbooks/configure_undercloud.yml b/lib/ansible/playbooks/configure_undercloud.yml
index 60afca9..e9ce875 100644
--- a/lib/ansible/playbooks/configure_undercloud.yml
+++ b/lib/ansible/playbooks/configure_undercloud.yml
@@ -32,6 +32,18 @@
regexp: 'Defaults\s*requiretty'
state: absent
become: yes
+ - lineinfile:
+ path: /etc/environment
+ regexp: '^http_proxy'
+ line: "http_proxy={{ http_proxy }}"
+ become: yes
+ when: http_proxy
+ - lineinfile:
+ path: /etc/environment
+ regexp: '^https_proxy'
+ line: "https_proxy={{ https_proxy }}"
+ become: yes
+ when: https_proxy
- name: openstack-configs undercloud
shell: openstack-config --set undercloud.conf DEFAULT {{ item }}
with_items: "{{ undercloud_config }}"