Fixes nic template missing in spec and error catching 17/14617/6
authorTim Rozet <trozet@redhat.com>
Tue, 24 May 2016 21:14:36 +0000 (17:14 -0400)
committerTim Rozet <trozet@redhat.com>
Wed, 25 May 2016 18:05:26 +0000 (14:05 -0400)
Issue where jinja 2 templates were missing from spec file.  Also adds
error checking to make sure the nic templates were correctly generated.
There was an error with dependencies missing on the build server - this
patch includes a fix to make sure it is installed before trying to make.

Change-Id: I7989ccf297a4e0d81326cccc06b2132018e7d8ae
Signed-off-by: Tim Rozet <trozet@redhat.com>
build/opnfv-apex-undercloud.spec
ci/build.sh
ci/deploy.sh

index ae72485..0e4798b 100644 (file)
@@ -27,6 +27,8 @@ install build/undercloud.qcow2 %{buildroot}%{_var}/opt/opnfv/images/
 install build/network-environment.yaml %{buildroot}%{_var}/opt/opnfv/
 install build/nics-controller.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-controller.yaml.template
 install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-compute.yaml.template
+install build/nics-controller.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-controller.yaml.jinja2
+install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-compute.yaml.jinja2
 
 %files
 %defattr(644, root, root, -)
@@ -34,8 +36,13 @@ install build/nics-compute.yaml.template %{buildroot}%{_var}/opt/opnfv/nics-comp
 %{_var}/opt/opnfv/network-environment.yaml
 %{_var}/opt/opnfv/nics-controller.yaml.template
 %{_var}/opt/opnfv/nics-compute.yaml.template
+%{_var}/opt/opnfv/nics-controller.yaml.jinja2
+%{_var}/opt/opnfv/nics-compute.yaml.jinja2
+
 
 %changelog
+* Thu May 24 2016 Tim Rozet <trozet@redhat.com> - 3.0-1
+- Adds jinja2 nic templates
 * Mon Apr 04 2016 Dan Radez <dradez@redhat.com> - 3.0-0
 - Version update for Colorado
 * Wed Mar 30 2016 Dan Radez <dradez@redhat.com> - 2.1-2
index 7e080be..e687055 100755 (executable)
@@ -35,6 +35,7 @@ CACHE_DEST=""
 CACHE_DIR="cache"
 CACHE_NAME="apex-cache"
 MAKE_TARGETS="images"
+REQUIRED_PKGS="rpm-build python-docutils"
 
 parse_cmdline() {
   while [ "${1:0:1}" = "-" ]
@@ -82,6 +83,16 @@ run_make() {
 
 parse_cmdline "$@"
 
+# Install build dependencies
+for pkg in $REQUIRED_PKGS; do
+  if ! rpm -q $pkg > /dev/null; then
+    if ! sudo yum -y install $pkg > /dev/null; then
+      echo "Required package $pkg missing and installation failed."
+      exit 1
+    fi
+  fi
+done
+
 if [ -n "$RELEASE" ]; then MAKE_ARGS+="RELEASE=$RELEASE "; fi
 
 # Get the Old Cache
index 59cfc6d..677d448 100755 (executable)
@@ -618,7 +618,7 @@ function configure_network_environment {
 ##Copy over the glance images and instackenv json file
 ##params: none
 function configure_undercloud {
-
+  local controller_nic_template compute_nic_template
   echo
   echo "Copying configuration files to Undercloud"
   if [[ "$net_isolation_enabled" == "TRUE" ]]; then
@@ -626,13 +626,22 @@ function configure_undercloud {
     echo -e "${blue}Network Environment set for Deployment: ${reset}"
     cat $CONFIG/network-environment.yaml
     scp ${SSH_OPTIONS[@]} $CONFIG/network-environment.yaml "stack@$UNDERCLOUD":
+    if ! controller_nic_template=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-controller.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
+      echo -e "${red}ERROR: Failed to generate controller NIC heat template ${reset}"
+      exit 1
+    fi
+
+    if ! compute_nic_template=$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-compute.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family); then
+      echo -e "${red}ERROR: Failed to generate compute NIC heat template ${reset}"
+      exit 1
+    fi
     ssh -T ${SSH_OPTIONS[@]} "stack@$UNDERCLOUD" << EOI
 mkdir nics/
 cat > nics/controller.yaml << EOF
-$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-controller.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family)
+$controller_nic_template
 EOF
 cat > nics/compute.yaml << EOF
-$(python3.4 -B $CONFIG/lib/python/apex-python-utils.py nic_template -d $CONFIG -f nics-compute.yaml.jinja2 -n "$enabled_network_list" -e $ext_net_type -af $ip_addr_family)
+$compute_nic_template
 EOF
 EOI
   fi