Merge lp:~codehelp/lava-deployment-tool/1224613 into lp:~linaro-validation/lava-deployment-tool/trunk

Proposed by Neil Williams
Status: Merged
Approved by: Neil Williams
Approved revision: 259
Merged at revision: 258
Proposed branch: lp:~codehelp/lava-deployment-tool/1224613
Merge into: lp:~linaro-validation/lava-deployment-tool/trunk
Prerequisite: lp:~codehelp/lava-deployment-tool/salt-docs
Diff against target: 76 lines (+28/-5)
1 file modified
lava-deployment-tool (+28/-5)
To merge this branch: bzr merge lp:~codehelp/lava-deployment-tool/1224613
Reviewer Review Type Date Requested Status
Antonio Terceiro Approve
Review via email: mp+185442@code.launchpad.net

Description of the change

Adds idempotent support for creating the lava-coordinator configuration file on worker nodes only.

To post a comment you must log in.
Revision history for this message
Antonio Terceiro (terceiro) wrote :

> === modified file 'lava-deployment-tool'
> --- lava-deployment-tool 2013-09-13 09:05:47 +0000
> +++ lava-deployment-tool 2013-09-13 09:05:48 +0000
> @@ -33,7 +33,7 @@
>
> # Installation and configuration steps (all the wizard_xxx install_xxx functions)
> LAVA_INSTALL_STEPS="devmode user fs buildout database web_hosting app config_app docs"
> -LAVA_WORKER_STEPS="get_master devmode user fs buildout remote_database web_hosting app config_app remote_fs"
> +LAVA_WORKER_STEPS="get_master devmode user fs buildout remote_database web_hosting app config_app remote_fs coordinator"
>
> # Will cause Django to be run with DEBUG enabled.
> LAVA_DEV_MODE=no
> @@ -666,6 +666,27 @@
> ssh-keyscan -H $LAVA_REMOTE_FS_HOST | sudo -u $LAVA_SYS_USER tee $sshdir/known_hosts
> }
>
> +install_coordinator () {
> + # put the lava-coordinator conf file in place
> + if [ ! -d /etc/lava-coordinator ]; then
> + sudo mkdir /etc/lava-coordinator
> + fi
> + if [ ! -f /etc/lava-coordinator/lava-coordinator.conf ]; then
> + sudo sh -c "cat >/etc/lava-coordinator/lava-coordinator.conf" <<EOF

this won't work because the shell redirection is handled by shell running the
lava-deployment-tool process with the UID of the user running it.

you want something like this:

  sudo tee /etc/lava-coordinator/lava-coordinator.conf >/dev/null <<EOF

Revision history for this message
Antonio Terceiro (terceiro) wrote :

On Fri, Sep 13, 2013 at 11:17:22AM -0300, Antonio Terceiro wrote:
> > === modified file 'lava-deployment-tool'
> > --- lava-deployment-tool 2013-09-13 09:05:47 +0000
> > +++ lava-deployment-tool 2013-09-13 09:05:48 +0000
> > @@ -33,7 +33,7 @@
> >
> > # Installation and configuration steps (all the wizard_xxx install_xxx functions)
> > LAVA_INSTALL_STEPS="devmode user fs buildout database web_hosting app config_app docs"
> > -LAVA_WORKER_STEPS="get_master devmode user fs buildout remote_database web_hosting app config_app remote_fs"
> > +LAVA_WORKER_STEPS="get_master devmode user fs buildout remote_database web_hosting app config_app remote_fs coordinator"
> >
> > # Will cause Django to be run with DEBUG enabled.
> > LAVA_DEV_MODE=no
> > @@ -666,6 +666,27 @@
> > ssh-keyscan -H $LAVA_REMOTE_FS_HOST | sudo -u $LAVA_SYS_USER tee $sshdir/known_hosts
> > }
> >
> > +install_coordinator () {
> > + # put the lava-coordinator conf file in place
> > + if [ ! -d /etc/lava-coordinator ]; then
> > + sudo mkdir /etc/lava-coordinator
> > + fi
> > + if [ ! -f /etc/lava-coordinator/lava-coordinator.conf ]; then
> > + sudo sh -c "cat >/etc/lava-coordinator/lava-coordinator.conf" <<EOF
>
> this won't work because the shell redirection is handled by shell running the
> lava-deployment-tool process with the UID of the user running it.
>
> you want something like this:
>
> sudo tee /etc/lava-coordinator/lava-coordinator.conf >/dev/null <<EOF

Nah, I'm wrong. The redirection is inside the -c argument and it will
work as intended. Nevermind

 review approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava-deployment-tool'
2--- lava-deployment-tool 2013-09-13 09:05:47 +0000
3+++ lava-deployment-tool 2013-09-13 09:05:48 +0000
4@@ -33,7 +33,7 @@
5
6 # Installation and configuration steps (all the wizard_xxx install_xxx functions)
7 LAVA_INSTALL_STEPS="devmode user fs buildout database web_hosting app config_app docs"
8-LAVA_WORKER_STEPS="get_master devmode user fs buildout remote_database web_hosting app config_app remote_fs"
9+LAVA_WORKER_STEPS="get_master devmode user fs buildout remote_database web_hosting app config_app remote_fs coordinator"
10
11 # Will cause Django to be run with DEBUG enabled.
12 LAVA_DEV_MODE=no
13@@ -666,6 +666,27 @@
14 ssh-keyscan -H $LAVA_REMOTE_FS_HOST | sudo -u $LAVA_SYS_USER tee $sshdir/known_hosts
15 }
16
17+install_coordinator () {
18+ # put the lava-coordinator conf file in place
19+ if [ ! -d /etc/lava-coordinator ]; then
20+ sudo mkdir /etc/lava-coordinator
21+ fi
22+ if [ ! -f /etc/lava-coordinator/lava-coordinator.conf ]; then
23+ sudo sh -c "cat >/etc/lava-coordinator/lava-coordinator.conf" <<EOF
24+{
25+ "port": 3079,
26+ "blocksize": 4096,
27+ "poll_delay": 3,
28+ "coordinator_hostname": "$LAVA_MASTER"
29+}
30+EOF
31+ fi
32+}
33+
34+wizard_coordinator () {
35+ true
36+}
37+
38 defaults_buildout () {
39 true
40 }
41@@ -990,6 +1011,7 @@
42 else
43 rm $BASE/*
44 fi
45+ cwd=`pwd`
46 cd `dirname $0`
47 if [ ! -d ./doc/modules ]; then
48 mkdir ./doc/modules
49@@ -999,7 +1021,6 @@
50 if [ -d doc/_build ]; then
51 rm -rf doc/_build/
52 fi
53- cwd=`pwd`
54 for dir in $LAVA_PREFIX/$LAVA_INSTANCE/code/current/branch-cache/*; do
55 module=`basename $dir`
56 latest=`ls -t1 $dir/checkouts/|head -n1`
57@@ -1128,6 +1149,11 @@
58 gen_lava_dispatcher_config
59
60 ln -sfT $code $LAVA_PREFIX/$LAVA_INSTANCE/code/current
61+ if [ "$LAVA_INSTALL_STEPS" != "$LAVA_WORKER_STEPS" ] ; then
62+ install_docs
63+ # the coordinator call is idempotent
64+ install_coordinator
65+ fi
66 }
67
68
69@@ -1705,9 +1731,6 @@
70 install_app
71 _maybe_post_convert_to_buildout
72 install_config_app
73- if [ "$LAVA_INSTALL_STEPS" != "$LAVA_WORKER_STEPS" ] ; then
74- install_docs
75- fi
76 }
77
78

Subscribers

People subscribed via source and target branches