Fixes python2 docutils req and also installs ansible 63/52163/3
authorTim Rozet <trozet@redhat.com>
Wed, 14 Feb 2018 18:12:39 +0000 (13:12 -0500)
committerTim Rozet <trozet@redhat.com>
Thu, 15 Feb 2018 17:00:05 +0000 (12:00 -0500)
For some reason we were requiring python2-docutils in to build our rpm
instead of python34-docutils.  Patch also includes some logic to install
ansible.

JIRA: APEX-515

Change-Id: I1b85e5b4b29f74f5ff5399296f24831c334c289c
Signed-off-by: Tim Rozet <trozet@redhat.com>
apex/build.py
apex/common/utils.py
apex/deploy.py
build/Makefile
build/rpm_specs/opnfv-apex-common.spec
requirements.txt

index 08f91ab..dff25ac 100644 (file)
@@ -225,6 +225,7 @@ def main():
     console.setLevel(log_level)
     console.setFormatter(logging.Formatter(formatter))
     logging.getLogger('').addHandler(console)
+    utils.install_ansible()
     # Since we only support building inside of git repo this should be fine
     try:
         apex_root = subprocess.check_output(
index 13250a4..0328a3b 100644 (file)
@@ -8,6 +8,7 @@
 ##############################################################################
 
 import datetime
+import distro
 import json
 import logging
 import os
@@ -192,3 +193,20 @@ def fetch_upstream_and_unpack(dest, url, targets):
             tar = tarfile.open(target_dest)
             tar.extractall(path=dest)
             tar.close()
+
+
+def install_ansible():
+    # we only install for CentOS/Fedora for now
+    dist = distro.id()
+    if 'centos' in dist:
+        pkg_mgr = 'yum'
+    elif 'fedora' in dist:
+        pkg_mgr = 'dnf'
+    else:
+        return
+
+    # yum python module only exists for 2.x, so use subprocess
+    try:
+        subprocess.check_call([pkg_mgr, '-y', 'install', 'ansible'])
+    except subprocess.CalledProcessError:
+        logging.warning('Unable to install Ansible')
index d2f7d50..5171c5c 100644 (file)
@@ -234,6 +234,7 @@ def main():
     console.setLevel(log_level)
     console.setFormatter(logging.Formatter(formatter))
     logging.getLogger('').addHandler(console)
+    utils.install_ansible()
     validate_deploy_args(args)
     # Parse all settings
     deploy_settings = DeploySettings(args.deploy_settings_file)
index 729b3ce..fb6734b 100644 (file)
@@ -291,6 +291,7 @@ iso:        iso-clean images rpms $(CENTISO)
        cd $(BUILD_DIR)/centos/Packages && curl -O http://artifacts.opnfv.org/apex/dependencies/python34-pygerrit2-2.0.3-1.el7.centos.noarch.rpm
        cd $(BUILD_DIR)/centos/Packages && curl -O http://artifacts.opnfv.org/apex/dependencies/python34-gitdb2-2.0.3-1.el7.centos.noarch.rpm
        cd $(BUILD_DIR)/centos/Packages && curl -O http://artifacts.opnfv.org/apex/dependencies/python34-GitPython-2.1.7-1.el7.centos.noarch.rpm
+       cd $(BUILD_DIR)/centos/Packages && curl -O http://artifacts.opnfv.org/apex/dependencies/python34-distro-1.2.0-1.el7.centos.noarch.rpm
        # regenerate yum repo data
        @echo "Generating new yum metadata"
        createrepo --update -g $(BUILD_ROOT)/c7-opnfv-x86_64-comps.xml $(BUILD_DIR)/centos
index 342f442..f8226e4 100644 (file)
@@ -11,13 +11,13 @@ URL:                https://gerrit.opnfv.org/gerrit/apex.git
 Source0:       opnfv-apex-common.tar.gz
 
 BuildArch:      noarch
-BuildRequires:  python-docutils python34-devel
+BuildRequires:  python34-docutils python34-devel
 Requires:       opnfv-apex-sdn opnfv-apex-undercloud openvswitch qemu-kvm bridge-utils libguestfs-tools python34-libvirt
 Requires:       initscripts net-tools iputils iproute iptables python34 python34-yaml python34-jinja2 python3-ipmi python34-virtualbmc
 Requires:       ipxe-roms-qemu >= 20160127-1
 Requires:       libvirt-devel ansible
 Requires:       python34-iptables python34-cryptography python34-pbr
-Requires:       python34-GitPython python34-pygerrit2
+Requires:       python34-GitPython python34-pygerrit2 python34-distro
 
 %description
 Scripts for OPNFV deployment using Apex
@@ -118,6 +118,8 @@ install config/inventory/pod_example_settings.yaml %{buildroot}%{_docdir}/opnfv/
 %doc %{_docdir}/opnfv/inventory.yaml.example
 
 %changelog
+* Wed Feb 14 2018 Tim Rozet <trozet@redhat.com> - 6.0-1
+  Fix docutils requirement and add python34-distro
 * Wed Nov 29 2017 Tim Rozet <trozet@redhat.com> - 6.0-0
   Bump version for Fraser
 * Wed Oct 25 2017 Tim Rozet <trozet@redhat.com> - 5.0-9
index 0326a8c..18bd020 100644 (file)
@@ -11,3 +11,4 @@ PyYAML
 Jinja2>=2.8
 GitPython
 pygerrit2
+distro