Merge lp:~benji/ubuntu/precise/lxc/bug-945183 into lp:ubuntu/precise/lxc

Proposed by Benji York
Status: Merged
Merged at revision: 71
Proposed branch: lp:~benji/ubuntu/precise/lxc/bug-945183
Merge into: lp:ubuntu/precise/lxc
Diff against target: 78 lines (+22/-4)
2 files modified
debian/changelog (+6/-0)
debian/local/lxc-start-ephemeral (+16/-4)
To merge this branch: bzr merge lp:~benji/ubuntu/precise/lxc/bug-945183
Reviewer Review Type Date Requested Status
Serge Hallyn (community) Approve
Ubuntu branches Pending
Review via email: mp+95678@code.launchpad.net

Description of the change

This fixes bug 945183 by adding -u (--user) and -S (--ssh-key) options.

To post a comment you must log in.
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks, looks great.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-02-28 15:03:45 +0000
3+++ debian/changelog 2012-03-02 22:26:20 +0000
4@@ -1,3 +1,9 @@
5+lxc (0.7.5-3ubuntu32) precise; urgency=low
6+
7+ * add user (-u) and key (-S) to lxc-start-ephemeral. (LP: #945183)
8+
9+ -- benji <benji.york@canonical.com> Fri, 02 Mar 2012 17:20:46 -0500
10+
11 lxc (0.7.5-3ubuntu31) precise; urgency=low
12
13 * 0050-clone-lvm-sizes: make lxc-clone with lvm snapshots create a
14
15=== modified file 'debian/local/lxc-start-ephemeral' (properties changed: -x to +x)
16--- debian/local/lxc-start-ephemeral 2012-02-16 16:47:03 +0000
17+++ debian/local/lxc-start-ephemeral 2012-03-02 22:26:20 +0000
18@@ -8,7 +8,7 @@
19 LXC_BIND=""
20
21 usage() {
22- echo "usage: lxc-start-ephemeral [-h] [-b bdir] -o orig -- [COMMAND [ARGS...]]"
23+ echo "usage: lxc-start-ephemeral [-h] [-b bdir] [-u user] [-S key] -o orig -- [COMMAND [ARGS...]]"
24 }
25
26 help() {
27@@ -19,13 +19,15 @@
28 echo "Options:"
29 echo "orig : name of the original container"
30 echo "bdir : directory to bind mount into container"
31+ echo "user : the user to connect to the container as"
32+ echo "key : the path to the SSH key to use to connect"
33 echo
34 echo "if a COMMAND is given, then the container will run only as long"
35 echo "as the command runs. If no COMMAND is given, this command will"
36 echo "wait until the container is shut down"
37 }
38
39-shortoptions='hb:o:'
40+shortoptions='hb:o:u:S:'
41 longoptions='help,orig:,bdir:'
42
43 LXC_RUNNING=0
44@@ -74,6 +76,16 @@
45 LXC_BIND=$1
46 shift
47 ;;
48+ -u|--user)
49+ shift
50+ LXC_USER=$1
51+ shift
52+ ;;
53+ -S|--ssh-key)
54+ shift
55+ LXC_KEY="-i $1"
56+ shift
57+ ;;
58 --)
59 shift
60 break;;
61@@ -85,7 +97,7 @@
62 esac
63 done
64
65-LXC_USER=`id -un`
66+LXC_USER=${LXC_USER:-`id -un`}
67
68 # validation
69
70@@ -144,7 +156,7 @@
71 # Repeatedly try to connect over SSH until we either succeed
72 # or time out.
73 for i in $(seq 1 30); do
74- ssh -n -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $LXC_USER@$IP_ADDRESS -- "$@"
75+ ssh -n -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $LXC_KEY $LXC_USER@$IP_ADDRESS -- "$@"
76 if [ ! 255 -eq $? ]; then
77 # If ssh returns 255 then its connection failed.
78 # Anything else is either success (status 0) or a

Subscribers

People subscribed via source and target branches

to all changes: