Merge lp:~terceiro/lava-deployment-tool/missing-install_devmode-function into lp:~linaro-validation/lava-deployment-tool/trunk

Proposed by Antonio Terceiro
Status: Merged
Merge reported by: Antonio Terceiro
Merged at revision: not available
Proposed branch: lp:~terceiro/lava-deployment-tool/missing-install_devmode-function
Merge into: lp:~linaro-validation/lava-deployment-tool/trunk
Diff against target: 199 lines (+75/-44)
1 file modified
lava-deployment-tool (+75/-44)
To merge this branch: bzr merge lp:~terceiro/lava-deployment-tool/missing-install_devmode-function
Reviewer Review Type Date Requested Status
Stevan Radaković Approve
Review via email: mp+183002@code.launchpad.net

Description of the change

Add missing function. It does not need to do anything, just be there to be called.

To post a comment you must log in.
Revision history for this message
Stevan Radaković (stevanr) wrote :

Looks good.
Approve +1.

review: Approve
249. By Antonio Terceiro

Forbid removing instances in non-interactive mode

250. By Antonio Terceiro

Fix indentation

251. By Antonio Terceiro

Allow removing instance in non-interactive mode with --force

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lava-deployment-tool'
--- lava-deployment-tool 2013-08-29 23:10:35 +0000
+++ lava-deployment-tool 2013-09-02 18:06:05 +0000
@@ -42,6 +42,9 @@
42LAVA_NON_INTERACTIVE=no42LAVA_NON_INTERACTIVE=no
43LAVA_DB_CUSTOMPWD=no43LAVA_DB_CUSTOMPWD=no
4444
45# force destructive actions, specially in non-interactive mode
46LAVA_FORCE=no
47
45os_check() {48os_check() {
46 case `lsb_release -i -s` in49 case `lsb_release -i -s` in
47 Ubuntu)50 Ubuntu)
@@ -351,6 +354,10 @@
351 return 1 # another loop please354 return 1 # another loop please
352}355}
353356
357install_devmode() {
358 true
359}
360
354defaults_user() {361defaults_user() {
355 if [ $LAVA_DEV_MODE = "yes" ]; then362 if [ $LAVA_DEV_MODE = "yes" ]; then
356 export LAVA_SYS_USER=$(whoami)363 export LAVA_SYS_USER=$(whoami)
@@ -447,50 +454,50 @@
447_ssh_install() {454_ssh_install() {
448 sshdir=$(eval echo ~$LAVA_SYS_USER)/.ssh455 sshdir=$(eval echo ~$LAVA_SYS_USER)/.ssh
449 if [ "$LAVA_INSTALL_STEPS" = "$LAVA_WORKER_STEPS" ]456 if [ "$LAVA_INSTALL_STEPS" = "$LAVA_WORKER_STEPS" ]
450 then457 then
451 # we are configuring a worker458 # we are configuring a worker
452 if [ ! -d $sshdir ]459 if [ ! -d $sshdir ]
453 then460 then
454 echo "SSH directory (${sshdir}) not found, creating it"461 echo "SSH directory (${sshdir}) not found, creating it"
455 sudo mkdir -p $sshdir462 sudo mkdir -p $sshdir
456 sudo chown $LAVA_SYS_USER $sshdir463 sudo chown $LAVA_SYS_USER $sshdir
457 fi464 fi
458465
459 if [ ! -f $sshdir/id_rsa ]466 if [ ! -f $sshdir/id_rsa ]
460 then467 then
461 echo "Creating RSA ssh key for user $LAVA_SYS_USER"468 echo "Creating RSA ssh key for user $LAVA_SYS_USER"
462 sudo -u $LAVA_SYS_USER ssh-keygen -C "ssh key used by LAVA for sshfs" -f $sshdir/id_rsa -t rsa -N ""469 sudo -u $LAVA_SYS_USER ssh-keygen -C "ssh key used by LAVA for sshfs" -f $sshdir/id_rsa -t rsa -N ""
463 fi470 fi
464471
465 # we don't want anything under media since this will get mounted472 # we don't want anything under media since this will get mounted
466 sudo rm -rf $LAVA_PREFIX/$LAVA_INSTANCE/var/lib/lava-server/media/*473 sudo rm -rf $LAVA_PREFIX/$LAVA_INSTANCE/var/lib/lava-server/media/*
467 else474 else
468 ### we are configuring a master475 ### we are configuring a master
469 # Setup the ssh directories in case you want to point workers at this master476 # Setup the ssh directories in case you want to point workers at this master
470 if [ ! -d $sshdir ]477 if [ ! -d $sshdir ]
471 then478 then
472 echo "Creating SSH directory (${sshdir}) as it didn't exist"479 echo "Creating SSH directory (${sshdir}) as it didn't exist"
473 sudo mkdir -p $sshdir480 sudo mkdir -p $sshdir
474 sudo chown -R $LAVA_SYS_USER:$LAVA_SYS_USER $sshdir481 sudo chown -R $LAVA_SYS_USER:$LAVA_SYS_USER $sshdir
475 sudo chmod 700 $sshdir482 sudo chmod 700 $sshdir
476 fi483 fi
477484
478 if [ ! -f $sshdir/authorized_keys ]485 if [ ! -f $sshdir/authorized_keys ]
479 then486 then
480 echo "Creating an authorized_keys file, as it didn't exist"487 echo "Creating an authorized_keys file, as it didn't exist"
481 sudo touch $sshdir/authorized_keys488 sudo touch $sshdir/authorized_keys
482 sudo chown $LAVA_SYS_USER:$LAVA_SYS_USER $sshdir/authorized_keys489 sudo chown $LAVA_SYS_USER:$LAVA_SYS_USER $sshdir/authorized_keys
483 sudo chmod 600 $sshdir/authorized_keys490 sudo chmod 600 $sshdir/authorized_keys
484 fi491 fi
485492
486 # this file will allow worker nodes to check if the directory is493 # this file will allow worker nodes to check if the directory is
487 # properly mounted or not494 # properly mounted or not
488 sudo touch $LAVA_PREFIX/$LAVA_INSTANCE/var/lib/lava-server/media/.mounted495 sudo touch $LAVA_PREFIX/$LAVA_INSTANCE/var/lib/lava-server/media/.mounted
489496
490 # ensure lava-logs and job-output is group writeable for new sshfs workers497 # ensure lava-logs and job-output is group writeable for new sshfs workers
491 sudo chmod g+w $LAVA_PREFIX/$LAVA_INSTANCE/var/lib/lava-server/media/lava-logs498 sudo chmod g+w $LAVA_PREFIX/$LAVA_INSTANCE/var/lib/lava-server/media/lava-logs
492 sudo chmod g+w $LAVA_PREFIX/$LAVA_INSTANCE/var/lib/lava-server/media/job-output499 sudo chmod g+w $LAVA_PREFIX/$LAVA_INSTANCE/var/lib/lava-server/media/job-output
493 fi500 fi
494}501}
495502
496install_fs() {503install_fs() {
@@ -806,7 +813,7 @@
806 done 813 done
807 for hbafile in `find /etc/postgresql -name pg_hba.conf`814 for hbafile in `find /etc/postgresql -name pg_hba.conf`
808 do815 do
809 echo "host all all 0.0.0.0/0 trust" | sudo tee -a $hbafile > /dev/null816 echo "host all all 0.0.0.0/0 trust" | sudo tee -a $hbafile > /dev/null
810 done817 done
811 sudo /etc/init.d/postgresql restart818 sudo /etc/init.d/postgresql restart
812}819}
@@ -1226,7 +1233,7 @@
1226 migrate --noinput || die "Failed to run database migrations"1233 migrate --noinput || die "Failed to run database migrations"
1227 set +x1234 set +x
12281235
1229 echo "Starting instance again..."1236 echo "Starting instance again..."
1230 set -x1237 set -x
1231 sudo start lava-instance LAVA_INSTANCE=$LAVA_INSTANCE1238 sudo start lava-instance LAVA_INSTANCE=$LAVA_INSTANCE
1232 set +x1239 set +x
@@ -1686,6 +1693,19 @@
1686cmd_remove() {1693cmd_remove() {
1687 LAVA_INSTANCE=${1:-dev}1694 LAVA_INSTANCE=${1:-dev}
16881695
1696 local destroy=""
1697 if [ "$LAVA_NON_INTERACTIVE" = yes ]; then
1698 if [ "$LAVA_FORCE" = no ]; then
1699 echo
1700 echo "For safety reasons we do not allow removing an instance"
1701 echo "in non-interactive mode. Try again without -n/--non-interactive"
1702 echo "(or use --force)"
1703 exit 1
1704 else
1705 destroy="DESTROY"
1706 fi
1707 fi
1708
1689 _banner1709 _banner
16901710
1691 # Sanity checking, ensure that instance exists1711 # Sanity checking, ensure that instance exists
@@ -1711,8 +1731,11 @@
1711 echo "We will remove everything in $LAVA_PREFIX/$LAVA_INSTANCE"1731 echo "We will remove everything in $LAVA_PREFIX/$LAVA_INSTANCE"
1712 echo "We will remove the apache site $LAVA_INSTANCE.conf"1732 echo "We will remove the apache site $LAVA_INSTANCE.conf"
1713 echo1733 echo
1714 _read_input "Type DESTROY to continue: " RESPONSE1734 _read_input "Type DESTROY to continue: " RESPONSE "$destroy"
1715 test "$RESPONSE" = 'DESTROY' || return1735 if test "$RESPONSE" != 'DESTROY'; then
1736 echo "Instance removal aborted."
1737 exit 1
1738 fi
17161739
1717 logger "Removing LAVA instance $LAVA_INSTANCE"1740 logger "Removing LAVA instance $LAVA_INSTANCE"
17181741
@@ -2166,6 +2189,10 @@
2166 Runs non-interactively. Default answers for all questions2189 Runs non-interactively. Default answers for all questions
2167 will be assumed.2190 will be assumed.
21682191
2192-f, --force
2193 Forces potentially destructive actions to be performed, even in
2194 non-interactive mode.
2195
2169See the README file for instructions2196See the README file for instructions
2170END_OF_USAGE2197END_OF_USAGE
2171}2198}
@@ -2194,9 +2221,10 @@
2194 fi2221 fi
21952222
2196 options="2223 options="
2197 -o nd2224 -o ndf
2198 --long non-interactive2225 --long non-interactive
2199 --long developer-mode2226 --long developer-mode
2227 --long force
2200 "2228 "
2201 TEMP="$(getopt --name ${__FILE_NAME__} $options -- "$@")"2229 TEMP="$(getopt --name ${__FILE_NAME__} $options -- "$@")"
2202 getopt_status=$?2230 getopt_status=$?
@@ -2215,6 +2243,9 @@
2215 --developer-mode|-d)2243 --developer-mode|-d)
2216 LAVA_DEV_MODE=yes2244 LAVA_DEV_MODE=yes
2217 ;;2245 ;;
2246 --force|-f)
2247 LAVA_FORCE=yes
2248 ;;
2218 --)2249 --)
2219 break;;2250 break;;
2220 esac2251 esac

Subscribers

People subscribed via source and target branches