diff options
author | Ryota MIBU <r-mibu@cq.jp.nec.com> | 2017-02-06 02:03:58 +0000 |
---|---|---|
committer | Ryota MIBU <r-mibu@cq.jp.nec.com> | 2017-02-06 02:03:58 +0000 |
commit | c2496a94fa8b6a6548d9216a4799192ad3b23d33 (patch) | |
tree | 4c3642f866576efc5a4938b4c6ddb3e440580fef /ci/03-maasdeploy.sh | |
parent | fe8f6531947ae65939e977117f9b281fbe14bed3 (diff) |
bug fixes
- not to create '2' file by using '[[]]' instead of '[]'
- delete files which are needed only during build process
- update createresource() to support maas v2
Change-Id: I182bb2e62909dc0e1cb8494297ecab3872a067e5
Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
Diffstat (limited to 'ci/03-maasdeploy.sh')
-rwxr-xr-x | ci/03-maasdeploy.sh | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh index df47af6f..ce9d7312 100755 --- a/ci/03-maasdeploy.sh +++ b/ci/03-maasdeploy.sh @@ -112,16 +112,14 @@ fi # # make sure no password asked during the deployment. -echo "$USER ALL=(ALL) NOPASSWD:ALL" > 90-joid-init - -if [ -e /etc/sudoers.d/90-joid-init ]; then - sudo cp /etc/sudoers.d/90-joid-init 91-joid-init - sudo chown $USER:$USER 91-joid-init - sudo chmod 660 91-joid-init - sudo cat 90-joid-init >> 91-joid-init - sudo chown root:root 91-joid-init - sudo mv 91-joid-init /etc/sudoers.d/ +sudoer_file=/etc/sudoers.d/90-joid-init +sudoer_entry="$USER ALL=(ALL) NOPASSWD:ALL" +if [ -e $sudoer_file ]; then + if ! sudo grep -q "$sudoer_entry" $sudoer_file; then + sudo sed -i -e "1i$sudoer_entry" $sudoer_file + fi else + echo "$sudoer_entry" > 90-joid-init sudo chown root:root 90-joid-init sudo mv 90-joid-init /etc/sudoers.d/ fi @@ -147,6 +145,7 @@ if [ "$virtinstall" -eq 1 ]; then sudo virsh net-define default-net-org.xml sudo virsh net-destroy default sudo virsh net-start default + rm -f default-net-org.xml fi # @@ -338,6 +337,7 @@ addnodes(){ done fi sudo virsh -c qemu:///system define --file bootstrap + rm -f bootstrap maas $PROFILE machines create autodetect_nodegroup='yes' name='bootstrap' \ tags='bootstrap' hostname='bootstrap' power_type='virsh' mac_addresses=$bootstrapmac \ @@ -370,6 +370,7 @@ addnodes(){ sudo virsh -c qemu:///system define --file node1-control sudo virsh -c qemu:///system define --file node2-compute sudo virsh -c qemu:///system define --file node5-compute + rm -f node1-control node2-compute node5-compute maas $PROFILE machines create autodetect_nodegroup='yes' name='node1-control' \ @@ -563,7 +564,7 @@ fi # Add the cloud and controller credentials for MAAS for that lab. jujuver=`juju --version` -if [ "$jujuver" > "2" ]; then +if [[ "$jujuver" > "2" ]]; then addcloud addcredential fi |