allow input file to be unicycle yaml file 08/508/1
authordavidplunkett <dp7642@att.com>
Tue, 26 Mar 2019 02:31:45 +0000 (02:31 +0000)
committerdavidplunkett <dp7642@att.com>
Tue, 26 Mar 2019 02:31:45 +0000 (02:31 +0000)
Change-Id: I5ca1d5077ed9a12ad9172be099e5d7641c24c559
Signed-off-by: davidplunkett <dp7642@att.com>
buildrc
install_server_os.sh
setup_tools.sh

diff --git a/buildrc b/buildrc
index 04b430e..758916e 100644 (file)
--- a/buildrc
+++ b/buildrc
@@ -34,6 +34,7 @@ export HPE_ROOT=${HPE_ROOT:-$AKRAINO_ROOT/hpe}
 export REGION_ROOT=${REGION_ROOT:-$WEB_ROOT/region}
 export BUILD_ROOT=${BUILD_ROOT:-$AKRAINO_ROOT/server-config}
 export IPXE_ROOT=${IPXE_ROOT:-$AKRAINO_ROOT/ipxe}
+export YAML_ROOT=${YAML_ROOT:-$AKRAINO_ROOT/yaml_builds}
 
 export UBUNTU_URL=${UBUNTU_URL:-http://releases.ubuntu.com/16.04/ubuntu-16.04.6-server-amd64.iso}
 export BUILD_WEBPORT=8090
index 75d67ee..f15f7ec 100755 (executable)
@@ -85,6 +85,13 @@ BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 
 # LOAD SERVER VARIABLES IF SERVER RCFILE PROVIDED - OTHERWISE ASSUME THE VARIABLES HAVE BEEN EXPORTED
 if [ -n "$RCFILE" ] && [ -f "$RCFILE" ]; then
+    # IF RCFILE IS YAML FORMAL THEN CONVERT RCFILE TO PROPERTIES FILE
+    if [ "$(grep -vP '^#|^\s*$' $RCFILE | head -n 1)" = "---" ]; then
+        NEWRCFILE=$BUILD_ROOT/$(basename "$RCFILE" | cut -d. -f1)rc
+        echo "WARNING:  Converting yaml file [$RCFILE] to properties file [$NEWRCFILE]"
+        python $YAML_ROOT/scripts/jcopy.py $RCFILE $YAML_ROOT/tools/j2/serverrc.j2 $NEWRCFILE
+        export RCFILE=$NEWRCFILE
+    fi
     source $RCFILE
 fi
 
index 08b6d50..01e7590 100755 (executable)
@@ -42,6 +42,11 @@ esac
 done
 set -- "${POSITIONAL[@]}" # restore positional parameters
 
+# SKIP IF TOOLS HAVE ALREADY BEEN SETUP
+if [ -n "$REDFISH_TOOLS_SETUP" ]; then
+    exit 0
+fi
+
 # LOAD BUILD DEFAULT VALUES IF BUILD VARIABLES ARE NOT LOADED
 if [ -z "$AKRAINO_ROOT" ]; then
     BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -65,7 +70,7 @@ mkdir -p $BUILD_ROOT
 
 ## CHECK THAT REQUIRED PACKAGES ARE INSTALLED
 echo "Checking for known required packages"
-PACKAGES="xorriso sshpass python-requests python-pip coreutils"
+PACKAGES="docker python xorriso sshpass python-requests python-pip python-yaml python-jinja2 make gcc coreutils"
 for PKG in $PACKAGES ; do
     if ! apt list $PKG 2>/dev/null | grep "$PKG.*installed.*" ; then
         echo "Attempting to install missing package $PKG"
@@ -123,4 +128,4 @@ if [ ! -f "$HPE_ROOT/examples/Redfish/_redfishobject.py" ]; then
 fi
 
 echo "Tools are ready in [$AKRAINO_ROOT]"
-
+export REDFISH_TOOLS_SETUP="True"