X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=foreman%2Fci%2Fdeploy.sh;h=6771da0c1243da598ee3ee1a9a5b07415d4cd61a;hb=e65ed372ee84b1f634ec24002fb7bfd7d48fd7e7;hp=a978e382a3528d3e67c960586e18e53fa555946f;hpb=cdd5f89faafee6347671ae0a386ad3a78905610f;p=genesis.git diff --git a/foreman/ci/deploy.sh b/foreman/ci/deploy.sh index a978e38..6771da0 100755 --- a/foreman/ci/deploy.sh +++ b/foreman/ci/deploy.sh @@ -30,6 +30,7 @@ declare -A admin_ip_arr declare -A public_ip_arr vm_dir=/var/opt/opnfv +script=`realpath $0` ##END VARS ##FUNCTIONS @@ -324,7 +325,7 @@ parse_cmdline() { fi ##Validate nic args - if [ $nic_arg_flag -eq 1 ]; then + if [[ $nic_arg_flag -eq 1 ]]; then if [ -z "$virtual" ]; then for nic_type in admin_nic private_nic public_nic; do eval "nic_value=\$$nic_type" @@ -476,20 +477,12 @@ clean_tmp() { } ##clone genesis and move to node vm dir -##params: none -##usage: clone_bgs +##params: destination directory +##usage: clone_bgs /tmp/myvm/ clone_bgs() { - cd /tmp/ - rm -rf /tmp/genesis/ - - ##clone artifacts and move into foreman_vm dir - if ! GIT_SSL_NO_VERIFY=true git clone https://gerrit.opnfv.org/gerrit/genesis.git; then - printf '%s\n' 'deploy.sh: Unable to clone genesis repo' >&2 - exit 1 - fi - - mv -f /tmp/genesis/foreman/ci $vm_dir/foreman_vm - rm -rf /tmp/genesis/ + script_dir="`dirname "$script"`" + cp -fr $script_dir/ $1 + cp -fr $script_dir/../../common/puppet-opnfv $1 } ##validates the network settings and update VagrantFile with network settings @@ -500,7 +493,7 @@ configure_network() { ##if nic_arg_flag is set, then we don't figure out ##NICs dynamically - if [ $nic_arg_flag -eq 1 ]; then + if [[ $nic_arg_flag -eq 1 ]]; then echo "${blue}Static Network Interfaces Defined. Updating Vagrantfile...${reset}" if [ $virtual ]; then nic_list="$public_nic" @@ -516,7 +509,7 @@ configure_network() { echo "${blue}Detecting network configuration...${reset}" ##detect host 1 or 3 interface configuration #output=`ip link show | grep -E "^[0-9]" | grep -Ev ": lo|tun|virbr|vboxnet" | awk '{print $2}' | sed 's/://'` - output=`ifconfig | grep -E "^[a-zA-Z0-9]+:"| grep -Ev "lo|tun|virbr|vboxnet" | awk '{print $1}' | sed 's/://'` + output=`/bin/ls -l /sys/class/net | tail -n +2 | grep -v virtual | cut -d " " -f10` fi if [ ! "$output" ]; then @@ -1000,20 +993,13 @@ start_virtual_nodes() { compute_wait_completed=false for node in ${nodes}; do - cd /tmp/ ##remove VM nodes incase it wasn't cleaned up rm -rf $vm_dir/$node rm -rf /tmp/genesis/ ##clone genesis and move into node folder - if ! GIT_SSL_NO_VERIFY=true git clone https://gerrit.opnfv.org/gerrit/genesis.git; then - printf '%s\n' 'deploy.sh: Unable to clone vagrant repo' >&2 - exit 1 - fi - - mv -f /tmp/genesis/foreman/ci $vm_dir/$node - rm -rf /tmp/genesis/ + clone_bgs $vm_dir/$node cd $vm_dir/$node @@ -1140,6 +1126,7 @@ start_virtual_nodes() { if ! vagrant ssh -c "route | grep default | grep $this_default_gw"; then echo "${blue} Adding public route back to $node! ${reset}" vagrant ssh -c "route add default gw $this_default_gw" + vagrant ssh -c "route delete default gw 10.0.2.2" fi popd done @@ -1230,7 +1217,7 @@ main() { install_vagrant clean_tmp verify_vm_dir - clone_bgs + clone_bgs $vm_dir/foreman_vm configure_network configure_virtual start_foreman