Support for py3 77/68377/2
authorManuel Buil <mbuil@suse.com>
Thu, 22 Aug 2019 07:50:31 +0000 (09:50 +0200)
committerManuel Buil <mbuil@suse.com>
Thu, 22 Aug 2019 17:13:38 +0000 (19:13 +0200)
This patch provides support for py3 in the deployment host and the OPNFV
VM. Some extra changes will need to happen in the future when distros
disclose how they will react to the py2 expiration.

* virtualbmc version is upgraded to 1.5 because 1.3 is not compatible with
py3
* The dynamic inventory is slightly modified because it was using
functionality that changes in py3
* pip3 check is removed as Ansible now works with py3

deploy-scenario:k8-calico-nofeature
installer-type:osh

Change-Id: I34178ebc357b0a299c0017d6f9e596b815c77b3b
Signed-off-by: Manuel Buil <mbuil@suse.com>
xci/files/xci-lib.sh
xci/playbooks/dynamic_inventory.py
xci/playbooks/roles/create-nodes/files/virtualbmc.conf [new file with mode: 0644]
xci/playbooks/roles/create-nodes/tasks/prepare_libvirt.yml

index d1e76f5..9e75149 100644 (file)
@@ -174,13 +174,6 @@ function install_ansible() {
 
     ${INSTALLER_CMD} ${install_map[@]}
 
-    # Note(cinerama): If pip is linked to pip3, the rest of the install
-    # won't work. Remove the alternatives. This is due to ansible's
-    # python 2.x requirement.
-    if [[ $(readlink -f /etc/alternatives/pip) =~ "pip3" ]]; then
-        sudo -H update-alternatives --remove pip $(readlink -f /etc/alternatives/pip)
-    fi
-
     # We need to prepare our virtualenv now
     virtualenv --quiet --no-site-packages ${XCI_VENV}
     set +u
index 0ea35ff..ed63141 100755 (executable)
@@ -127,8 +127,8 @@ class XCIInventory(object):
             for role in idf['xci']['installers'][self.installer]['nodes_roles'][host]:
                 self.add_to_group(role, hostname)
 
-            pdf_host_info = filter(lambda x: x['name'] == host, pdf['nodes'])[0]
-            native_vlan_if = filter(lambda x: x['vlan'] == 'native', pdf_host_info['interfaces'])
+            pdf_host_info = list(filter(lambda x: x['name'] == host, pdf['nodes']))[0]
+            native_vlan_if = list(filter(lambda x: x['vlan'] == 'native', pdf_host_info['interfaces']))
             self.add_hostvar(hostname, 'ansible_host', native_vlan_if[0]['address'])
             self.add_hostvar(hostname, 'ip', native_vlan_if[0]['address'])
             host_networks[hostname] = {}
@@ -173,7 +173,8 @@ class XCIInventory(object):
 
         # Now add the additional groups
         for parent in idf['xci']['installers'][self.installer]['groups'].keys():
-            map(lambda x: self.add_group(x, parent), idf['xci']['installers'][self.installer]['groups'][parent])
+            for host in idf['xci']['installers'][self.installer]['groups'][parent]:
+                self.add_group(host, parent)
 
         # Read additional group variables
         self.read_additional_group_vars()
diff --git a/xci/playbooks/roles/create-nodes/files/virtualbmc.conf b/xci/playbooks/roles/create-nodes/files/virtualbmc.conf
new file mode 100644 (file)
index 0000000..f8351dc
--- /dev/null
@@ -0,0 +1,3 @@
+[log]
+logfile: /var/log/vbmc.log
+debug: true
index faf19a6..06afaec 100644 (file)
 - name: install virtualbmc
   pip:
     name: virtualbmc
-    version: 1.3 # >1.3 needs zmq dependency.
+    version: 1.5 # >1.3 needs zmq dependency.
     virtualenv: "{{ lookup('env', 'XCI_VENV') }}"
+
+- name: Create directory for the config of vbmc
+  file:
+    path: /etc/virtualbmc
+    state: directory
+
+- name: Place the config for virtualbmc
+  copy:
+    src: virtualbmc.conf
+    dest: /etc/virtualbmc/virtualbmc.conf