Merge lp:~thomnico/orange-box/newnet into lp:~cpe-sa/orange-box/staging

Proposed by Nicolas Thomas
Status: Merged
Approved by: vio0au0d
Approved revision: 549
Merged at revision: 550
Proposed branch: lp:~thomnico/orange-box/newnet
Merge into: lp:~cpe-sa/orange-box/staging
Diff against target: 17 lines (+7/-0)
1 file modified
usr/bin/orange-box-add-virtual-nodes (+7/-0)
To merge this branch: bzr merge lp:~thomnico/orange-box/newnet
Reviewer Review Type Date Requested Status
vio0au0d (community) Approve
Review via email: mp+265423@code.launchpad.net

Description of the change

Add a fix for newly created systems when ubuntu user does not have a .ssh directocry and authorized-keys yet.

To post a comment you must log in.
lp:~thomnico/orange-box/newnet updated
549. By Nicolas Thomas

Remove entries to avoid conflicts

Revision history for this message
vio0au0d (chei6ied-deactivatedaccount) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'usr/bin/orange-box-add-virtual-nodes'
2--- usr/bin/orange-box-add-virtual-nodes 2015-07-21 00:17:39 +0000
3+++ usr/bin/orange-box-add-virtual-nodes 2015-07-21 17:58:26 +0000
4@@ -43,6 +43,13 @@
5 [ -f /var/lib/maas/.ssh/known_hosts ] || sudo -u maas ssh-keyscan 172.27.${orangebox_number}.1 |sudo -u maas tee -a /var/lib/maas/.ssh/known_hosts > /dev/null
6 #Always add host keys .. not an issue if files grows
7 sudo -u maas ssh-keyscan 172.27.${orangebox_number}.1 |sudo -u maas tee -a /var/lib/maas/.ssh/known_hosts > /dev/null
8+# if very first install ubuntu user might not have authorized keys set.
9+if [ ! -f /home/ubuntu/.ssh/authorized_keys ]; then
10+ mkdir -p /home/ubuntu/.ssh/
11+ cat /var/lib/maas/.ssh/id_rsa.pub | tee -a /home/ubuntu/.ssh/authorized_keys
12+ chown -R ubuntu /home/ubuntu/.ssh/
13+ chmod 700 /home/ubuntu/.ssh/
14+fi
15 sudo -u maas virsh -c qemu+ssh://ubuntu@172.27.${orangebox_number}.1/system list > /dev/null || sed -i '/ maas@/d' /home/ubuntu/.ssh/authorized_keys
16 #If there is no key /new install or just removed add it"
17 #echo -e "\n\n\n" | sudo -u maas ssh-keygen -N "" -t rsa -f /var/lib/maas/.ssh/id_rsa

Subscribers

People subscribed via source and target branches

to all changes: