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"
}
##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=`realpath $0`
+ 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
##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"
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 " " -f9`
fi
if [ ! "$output" ]; then
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
install_vagrant
clean_tmp
verify_vm_dir
- clone_bgs
+ clone_bgs $vm_dir/foreman_vm
configure_network
configure_virtual
start_foreman