diff options
-rw-r--r-- | build/parser.py | 2 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml | 2 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/setup-infrastructure/tasks/main.yml | 5 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/setup-infrastructure/vars/main.yml | 2 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/setup-openstack/tasks/main.yml | 2 | ||||
-rw-r--r-- | deploy/bonding.py | 2 | ||||
-rw-r--r-- | deploy/client.py | 9 | ||||
-rw-r--r-- | deploy/conf/baremetal.conf | 2 | ||||
-rw-r--r-- | deploy/conf/virtual.conf | 2 | ||||
-rw-r--r-- | deploy/config_parse.py | 2 | ||||
-rw-r--r-- | deploy/opera_adapter.py | 2 | ||||
-rwxr-xr-x | deploy/prepare.sh | 3 | ||||
-rw-r--r-- | deploy/rename_nics.py | 2 | ||||
-rw-r--r-- | deploy/reset_compute.py | 4 | ||||
-rw-r--r-- | deploy/setup_vnic.py | 2 | ||||
-rw-r--r-- | plugins/odl_cluster/tasks/control-agents-3.yml | 5 | ||||
-rw-r--r-- | plugins/odl_cluster/tasks/control-servers-2.yml | 4 | ||||
-rw-r--r-- | repo/gen_ins_pkg_script.py | 2 | ||||
-rw-r--r-- | util/check_valid.py | 2 |
19 files changed, 35 insertions, 21 deletions
diff --git a/build/parser.py b/build/parser.py index 602d7c21..63eb494f 100644 --- a/build/parser.py +++ b/build/parser.py @@ -80,7 +80,7 @@ def usage(): def build_parser(build_file_name): cache = load_env() - cfg = yaml.load(file(build_file_name, 'r')) + cfg = yaml.safe_load(file(build_file_name, 'r')) print "Starting building...." for pkg in cfg.get("packages"): diff --git a/deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml b/deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml index c878ab7f..e3b467cf 100644 --- a/deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml +++ b/deploy/adapters/ansible/roles/config-controller/tasks/Ubuntu.yml @@ -14,6 +14,8 @@ notify: - restart network service +- meta: flush_handlers + - name: check apt source shell: "ping -c 2 {{LOCAL_REPOSITORY_IP}} > /dev/null" register: checkresult diff --git a/deploy/adapters/ansible/roles/setup-infrastructure/tasks/main.yml b/deploy/adapters/ansible/roles/setup-infrastructure/tasks/main.yml index 5b70aeef..478c4d48 100644 --- a/deploy/adapters/ansible/roles/setup-infrastructure/tasks/main.yml +++ b/deploy/adapters/ansible/roles/setup-infrastructure/tasks/main.yml @@ -19,8 +19,9 @@ register: setup_infrastructure_result - fail: - msg: "there are some task failed when setup host." - when: setup_infrastructure_result.stdout.find('failed=1') != -1 + msg: "there are some task failed when setup infrastructure." + when: setup_infrastructure_result.stdout.find('failed={{item}}') != -1 + with_sequence: start=1 end={{ max_failed_times }} stride=1 - fail: msg: "some host are unreachable." diff --git a/deploy/adapters/ansible/roles/setup-infrastructure/vars/main.yml b/deploy/adapters/ansible/roles/setup-infrastructure/vars/main.yml new file mode 100644 index 00000000..22a990ef --- /dev/null +++ b/deploy/adapters/ansible/roles/setup-infrastructure/vars/main.yml @@ -0,0 +1,2 @@ +--- +max_failed_times: 9 diff --git a/deploy/adapters/ansible/roles/setup-openstack/tasks/main.yml b/deploy/adapters/ansible/roles/setup-openstack/tasks/main.yml index e5770245..b71612f7 100644 --- a/deploy/adapters/ansible/roles/setup-openstack/tasks/main.yml +++ b/deploy/adapters/ansible/roles/setup-openstack/tasks/main.yml @@ -19,7 +19,7 @@ register: setup_openstack_result - fail: - msg: "some task failed when setup host." + msg: "some task failed when setup openstack." when: setup_openstack_result.stdout.find('failed=1') != -1 - fail: diff --git a/deploy/bonding.py b/deploy/bonding.py index 27e76daa..17b5b205 100644 --- a/deploy/bonding.py +++ b/deploy/bonding.py @@ -34,7 +34,7 @@ def create_bonding(network_info, rsa_file, compass_ip): if __name__ == "__main__": assert(len(sys.argv) == 4) create_bonding( - yaml.load( + yaml.safe_load( open( sys.argv[1])), sys.argv[2], diff --git a/deploy/client.py b/deploy/client.py index 810ac118..366ae418 100644 --- a/deploy/client.py +++ b/deploy/client.py @@ -740,11 +740,11 @@ class CompassClient(object): package_config['network_mapping'] = network_mapping assert(os.path.exists(CONF.network_cfg)) - network_cfg = yaml.load(open(CONF.network_cfg)) + network_cfg = yaml.safe_load(open(CONF.network_cfg)) package_config["network_cfg"] = network_cfg assert(os.path.exists(CONF.neutron_cfg)) - neutron_cfg = yaml.load(open(CONF.neutron_cfg)) + neutron_cfg = yaml.safe_load(open(CONF.neutron_cfg)) package_config["neutron_config"] = neutron_cfg """ @@ -952,6 +952,9 @@ class CompassClient(object): deployment_timeout = time.time() + 60 * float(CONF.deployment_timeout) # noqa current_time = time.time while current_time() < deployment_timeout: + if not ansible_print.is_alive(): + raise RuntimeError("can not get ansible log") + status, cluster_state = self.get_cluster_state(cluster_id) if not self.is_ok(status): raise RuntimeError("can not get cluster state") @@ -975,7 +978,7 @@ class CompassClient(object): % (current_time(), deployment_timeout)) LOG.info("cobbler status:") os.system("sudo docker exec compass-cobbler bash -c \ - 'cobbler status'" % (CONF.rsa_file)) + 'cobbler status'") raise RuntimeError("installation timeout") try: diff --git a/deploy/conf/baremetal.conf b/deploy/conf/baremetal.conf index 56903c77..12f3acb7 100644 --- a/deploy/conf/baremetal.conf +++ b/deploy/conf/baremetal.conf @@ -1,5 +1,5 @@ export SWITCH_IPS="192.168.124.2" export SWITCH_CREDENTIAL="version=2c,community=public" -export DEPLOYMENT_TIMEOUT="150" +export DEPLOYMENT_TIMEOUT="300" export POLL_SWITCHES_FLAG="nopoll_switches" export INSTALL_NIC=${INSTALL_NIC:-eth3} diff --git a/deploy/conf/virtual.conf b/deploy/conf/virtual.conf index ab7e5680..1e9034f3 100644 --- a/deploy/conf/virtual.conf +++ b/deploy/conf/virtual.conf @@ -5,5 +5,5 @@ export VIRT_DISK=${VIRT_DISK:-200G} export SWITCH_IPS="1.1.1.1" export SWITCH_CREDENTIAL="version=2c,community=public" -export DEPLOYMENT_TIMEOUT="150" +export DEPLOYMENT_TIMEOUT="300" export POLL_SWITCHES_FLAG="nopoll_switches" diff --git a/deploy/config_parse.py b/deploy/config_parse.py index 363516b4..8a1ac54b 100644 --- a/deploy/config_parse.py +++ b/deploy/config_parse.py @@ -15,7 +15,7 @@ from Cheetah.Template import Template def init(file): with open(file) as fd: - return yaml.load(fd) + return yaml.safe_load(fd) def decorator(func): diff --git a/deploy/opera_adapter.py b/deploy/opera_adapter.py index 137aba54..fbf1b662 100644 --- a/deploy/opera_adapter.py +++ b/deploy/opera_adapter.py @@ -18,7 +18,7 @@ import traceback def load_file(file): with open(file) as fd: try: - return yaml.load(fd) + return yaml.safe_load(fd) except: traceback.print_exc() return None diff --git a/deploy/prepare.sh b/deploy/prepare.sh index 1da91a5f..a620ac98 100755 --- a/deploy/prepare.sh +++ b/deploy/prepare.sh @@ -111,7 +111,8 @@ function _prepare_python_env() { pip install netaddr==0.7.19 pip install oslo.config==4.6.0 pip install ansible==2.3.1.0 - pip install docker-compose==1.14.0 + # For sudo use + sudo pip install docker-compose==1.14.0 fi } diff --git a/deploy/rename_nics.py b/deploy/rename_nics.py index 2672c990..f78b3979 100644 --- a/deploy/rename_nics.py +++ b/deploy/rename_nics.py @@ -36,7 +36,7 @@ def rename_nics(dha_info, rsa_file, compass_ip, os_version): if __name__ == "__main__": assert(len(sys.argv) == 5) rename_nics( - yaml.load( + yaml.safe_load( open( sys.argv[1])), sys.argv[2], diff --git a/deploy/reset_compute.py b/deploy/reset_compute.py index 86afc4f1..2e5103ba 100644 --- a/deploy/reset_compute.py +++ b/deploy/reset_compute.py @@ -20,7 +20,7 @@ def exec_cmd(cmd): def reset_baremetal(dha_info): print "reset_baremetal" - hosts_info = yaml.load(open(dha_info)) + hosts_info = yaml.safe_load(open(dha_info)) # print hosts_info ipmiUserDf = hosts_info.get('ipmiUser', 'root') @@ -48,7 +48,7 @@ def reset_baremetal(dha_info): def reset_virtual(dha_info): print "reset_virtual" - hosts_info = yaml.load(open(dha_info)) + hosts_info = yaml.safe_load(open(dha_info)) print hosts_info hosts_list = hosts_info.get('hosts', []) diff --git a/deploy/setup_vnic.py b/deploy/setup_vnic.py index 7dcd8d94..de3b5ed6 100644 --- a/deploy/setup_vnic.py +++ b/deploy/setup_vnic.py @@ -13,7 +13,7 @@ import yaml if __name__ == "__main__": network_config_file = os.environ["NETWORK"] - network_config = yaml.load(open(network_config_file, "r")) + network_config = yaml.safe_load(open(network_config_file, "r")) os.system( "sudo ovs-vsctl --may-exist add-port br-external mgmt_vnic -- set Interface mgmt_vnic type=internal") # noqa os.system("sudo ip addr flush mgmt_vnic") diff --git a/plugins/odl_cluster/tasks/control-agents-3.yml b/plugins/odl_cluster/tasks/control-agents-3.yml index 9d7ddebf..68446a83 100644 --- a/plugins/odl_cluster/tasks/control-agents-3.yml +++ b/plugins/odl_cluster/tasks/control-agents-3.yml @@ -13,6 +13,11 @@ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12; when: odl_l3_agent == "Enable" +- name: configure external bridge name for L2 + shell: | + crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-provider; + when: odl_l3_agent == "Disable" + - name: configure opendaylight in ml2 shell: | crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ml2_odl username admin; diff --git a/plugins/odl_cluster/tasks/control-servers-2.yml b/plugins/odl_cluster/tasks/control-servers-2.yml index 5bfc24eb..59b3aa2f 100644 --- a/plugins/odl_cluster/tasks/control-servers-2.yml +++ b/plugins/odl_cluster/tasks/control-servers-2.yml @@ -19,9 +19,9 @@ crudini --set /etc/neutron/plugins/ml2/ml2_conf.ini ovs bridge_mappings physnet:eth12; when: odl_l3_agent == "Enable" -- name: configure external bridge name for L2 +- name: turn off l3 ha for odl l2 shell: | - crudini --set /etc/neutron/l3_agent.ini DEFAULT external_network_bridge br-provider; + crudini --set /etc/neutron/neutron.conf DEFAULT l3_ha "False"; when: odl_l3_agent == "Disable" - name: configure opendaylight in ml2 diff --git a/repo/gen_ins_pkg_script.py b/repo/gen_ins_pkg_script.py index 38d08c23..9af34143 100644 --- a/repo/gen_ins_pkg_script.py +++ b/repo/gen_ins_pkg_script.py @@ -32,7 +32,7 @@ def get_packages_name_list(file_list, special_packages): package_name_list = [] for file in file_list: - datas = yaml.load(open(file)) + datas = yaml.safe_load(open(file)) if not datas: continue diff --git a/util/check_valid.py b/util/check_valid.py index e3ad6bcd..e6a72e71 100644 --- a/util/check_valid.py +++ b/util/check_valid.py @@ -17,7 +17,7 @@ import traceback def load_file(file): with open(file) as fd: try: - return yaml.load(fd) + return yaml.safe_load(fd) except: traceback.print_exc() return None |