Fixed the aws commands
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/7ea42ea6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/7ea42ea6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/7ea42ea6 Branch: refs/heads/master Commit: 7ea42ea6f7274c856f9f7e30471408af1e44265a Parents: 61f57f1 Author: Anuradha Hegde <[email protected]> Authored: Fri Jan 8 18:30:26 2016 +0000 Committer: Anuradha Hegde <[email protected]> Committed: Fri Jan 8 18:30:26 2016 +0000 ---------------------------------------------------------------------- dcs/bin/scripts/dcsbind.sh | 12 ++++++------ install/installer/cloud_cli_setup | 20 ++++++++++++++++---- 2 files changed, 22 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7ea42ea6/dcs/bin/scripts/dcsbind.sh ---------------------------------------------------------------------- diff --git a/dcs/bin/scripts/dcsbind.sh b/dcs/bin/scripts/dcsbind.sh index d05fea4..f9f20cb 100755 --- a/dcs/bin/scripts/dcsbind.sh +++ b/dcs/bin/scripts/dcsbind.sh @@ -329,7 +329,7 @@ gv_float_external_interface="" gv_float_external_ip="" gv_float_internal_ip="" gv_port=0 -awscmd=/usr/local/bin/aws +awscmd="/usr/local/bin/aws ec2 --output text " gv_ok=0 gv_warn=1 @@ -362,23 +362,23 @@ else dcsEcho "Using device index $device_index_to_use for $gv_float_external_interface" # Get instance Id of the instance - INSTANCEID=`$awscmd ec2 describe-instances |grep -i instances |grep -i $gv_myhostname |cut -f8` + INSTANCEID=`$awscmd describe-instances |grep -i instances |grep -i $gv_myhostname |cut -f8` dcsEcho "Using Instance id $INSTANCEID" # Get the network interface configured for the vpc - NETWORKINTERFACE=`$awscmd ec2 describe-network-interfaces| grep -i networkinterfaces| grep -i $gv_float_internal_ip|cut -f5` + NETWORKINTERFACE=`$awscmd describe-network-interfaces| grep -i networkinterfaces| grep -i $gv_float_internal_ip|cut -f5` dcsEcho "Using network interface $NETWORKINTERFACE" # Get the attachment id for the network interface - ATTACH_ID=`$awscmd ec2 describe-network-interfaces --network-interface-ids $NETWORKINTERFACE |grep -i attachment |cut -f3` + ATTACH_ID=`$awscmd describe-network-interfaces --network-interface-ids $NETWORKINTERFACE |grep -i attachment |cut -f3` if [ ! -z "$ATTACH_ID" ]; then dcsEcho "Detaching attachment Id:" $ATTACH_ID - $awscmd ec2 detach-network-interface --attachment-id $ATTACH_ID + $awscmd detach-network-interface --attachment-id $ATTACH_ID fi dcsEcho "Going to attach network interface $NETWORKINTERFACE to the another instance" sleep 10 - NEWATTACH_ID=`$awscmd ec2 attach-network-interface --network-interface-id $NETWORKINTERFACE --instance-id $INSTANCEID --device-index $device_index_to_use` + NEWATTACH_ID=`$awscmd attach-network-interface --network-interface-id $NETWORKINTERFACE --instance-id $INSTANCEID --device-index $device_index_to_use` dcsEcho "New attachment Id " $NEWATTACH_ID sleep 10 configure_route_tables http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7ea42ea6/install/installer/cloud_cli_setup ---------------------------------------------------------------------- diff --git a/install/installer/cloud_cli_setup b/install/installer/cloud_cli_setup index 1edd479..408cbe9 100755 --- a/install/installer/cloud_cli_setup +++ b/install/installer/cloud_cli_setup @@ -31,7 +31,7 @@ if [ $node_count -eq 1 ]; then TRAF_PDCP="" else TRAF_PDSH="pdsh $MY_NODES" - TRAF_PDCP="pdcp -R ssh $MY_NODES" + TRAF_PDCP="pdcp -r $MY_NODES" fi ###### Setting up CLI for AWS as sudo id @@ -44,7 +44,7 @@ if [[ ! -z $AWS_CLOUD ]]; then unzip $HOME/awscli-bundle.zip if [[ $node_count -gt "1" ]]; then - $TRAF_PDCP -r $HOME/awscli-bundle $HOME + $TRAF_PDCP $HOME/awscli-bundle $HOME $TRAF_PDSH "sudo $HOME/awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws" | tee -a $INSTALL_LOG else $HOME/awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws | tee -a $INSTALL_LOG @@ -54,10 +54,16 @@ if [[ ! -z $AWS_CLOUD ]]; then rm -f $HOME/awscli-bundle.zip ###### Execute 'aws configure' command as a Trafodion Id + echo + echo "***INFO: Configuring AWS keys for executing CLI commands" + echo sudo su $TRAF_USER --login --command "/usr/local/bin/aws configure" ###### Copy the .aws folder to all nodes in the cluster for Trafodion Id - sudo su $TRAF_USER --login --command "$TRAF_PDCP -r $HOME_DIR/$TRAF_USER/.aws $HOME_DIR/$TRAF_USER" + sudo su $TRAF_USER --login --command "$TRAF_PDCP $HOME_DIR/$TRAF_USER/.aws $HOME_DIR/$TRAF_USER" + echo + echo "***INFO: AWS configuration located in $HOME_DIR/$TRAF_DIR/.aws" + echo else echo "AWS Configuration already exist for Trafodion Id" echo -n "Do you want to overwrite the configuration (Y/N), default is N: " @@ -65,10 +71,16 @@ if [[ ! -z $AWS_CLOUD ]]; then if [ ! -z $answer ]; then if [[ "${answer}" =~ ^[Yy]$ ]]; then ###### Execute 'aws configure' command as a Trafodion id + echo + echo "***INFO: Configuring AWS keys for executing CLI commands" + echo sudo su $TRAF_USER --login --command "/usr/local/bin/aws configure" ###### Copy the .aws folder to all nodes in the cluster for Trafodion Id - sudo su $TRAF_USER --login --command "$TRAF_PDCP -r $HOME_DIR/$TRAF_USER/.aws $HOME_DIR/$TRAF_USER" + sudo su $TRAF_USER --login --command "$TRAF_PDCP $HOME_DIR/$TRAF_USER/.aws $HOME_DIR/$TRAF_USER" + echo + echo "***INFO: AWS configuration located in $HOME_DIR/$TRAF_DIR/.aws" + echo fi fi fi
