Merge lp:~jameinel/juju-core/1.18-authorized-keys-1312537 into lp:juju-core/1.18
- 1.18-authorized-keys-1312537
- Merge into 1.18
Proposed by
John A Meinel
Status: | Merged |
---|---|
Approved by: | John A Meinel |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2277 |
Proposed branch: | lp:~jameinel/juju-core/1.18-authorized-keys-1312537 |
Merge into: | lp:juju-core/1.18 |
Diff against target: |
390 lines (+73/-43) 11 files modified
cmd/juju/authorizedkeys.go (+7/-6) cmd/juju/authorizedkeys_add.go (+1/-1) cmd/juju/authorizedkeys_delete.go (+1/-1) cmd/juju/authorizedkeys_import.go (+1/-1) cmd/juju/authorizedkeys_list.go (+2/-2) cmd/juju/authorizedkeys_test.go (+23/-23) cmd/juju/help_topics.go (+5/-5) cmd/juju/main.go (+2/-2) cmd/juju/main_test.go (+2/-1) cmd/supercommand.go (+6/-1) cmd/supercommand_test.go (+23/-0) |
To merge this branch: | bzr merge lp:~jameinel/juju-core/1.18-authorized-keys-1312537 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email:
|
Commit message
Rename authorised-keys to authorized-keys, but keep the other as an alias.
This makes us a bit more consistent with the value in environments.yaml.
(Addresses bug #1312537)
https:/
Description of the change
Retarget the "authorized-keys" switch to 1.18 where it was developed.
Self approving because the patch has already been approved for Trunk, and I got acceptance to put it into 1.18 as well.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === renamed file 'cmd/juju/authorisedkeys.go' => 'cmd/juju/authorizedkeys.go' | |||
2 | --- cmd/juju/authorisedkeys.go 2013-12-13 06:53:01 +0000 | |||
3 | +++ cmd/juju/authorizedkeys.go 2014-04-25 11:00:53 +0000 | |||
4 | @@ -15,17 +15,18 @@ | |||
5 | 15 | 15 | ||
6 | 16 | ` | 16 | ` |
7 | 17 | 17 | ||
9 | 18 | type AuthorisedKeysCommand struct { | 18 | type AuthorizedKeysCommand struct { |
10 | 19 | *cmd.SuperCommand | 19 | *cmd.SuperCommand |
11 | 20 | } | 20 | } |
12 | 21 | 21 | ||
15 | 22 | func NewAuthorisedKeysCommand() cmd.Command { | 22 | func NewAuthorizedKeysCommand() cmd.Command { |
16 | 23 | sshkeyscmd := &AuthorisedKeysCommand{ | 23 | sshkeyscmd := &AuthorizedKeysCommand{ |
17 | 24 | SuperCommand: cmd.NewSuperCommand(cmd.SuperCommandParams{ | 24 | SuperCommand: cmd.NewSuperCommand(cmd.SuperCommandParams{ |
19 | 25 | Name: "authorised-keys", | 25 | Name: "authorized-keys", |
20 | 26 | Doc: authKeysDoc, | 26 | Doc: authKeysDoc, |
21 | 27 | UsagePrefix: "juju", | 27 | UsagePrefix: "juju", |
23 | 28 | Purpose: "manage authorised ssh keys", | 28 | Purpose: "manage authorized ssh keys", |
24 | 29 | Aliases: []string{"authorised-keys"}, | ||
25 | 29 | }), | 30 | }), |
26 | 30 | } | 31 | } |
27 | 31 | sshkeyscmd.Register(&AddKeysCommand{}) | 32 | sshkeyscmd.Register(&AddKeysCommand{}) |
28 | @@ -35,6 +36,6 @@ | |||
29 | 35 | return sshkeyscmd | 36 | return sshkeyscmd |
30 | 36 | } | 37 | } |
31 | 37 | 38 | ||
33 | 38 | func (c *AuthorisedKeysCommand) SetFlags(f *gnuflag.FlagSet) { | 39 | func (c *AuthorizedKeysCommand) SetFlags(f *gnuflag.FlagSet) { |
34 | 39 | c.SetCommonFlags(f) | 40 | c.SetCommonFlags(f) |
35 | 40 | } | 41 | } |
36 | 41 | 42 | ||
37 | === renamed file 'cmd/juju/authorisedkeys_add.go' => 'cmd/juju/authorizedkeys_add.go' | |||
38 | --- cmd/juju/authorisedkeys_add.go 2013-12-13 06:53:01 +0000 | |||
39 | +++ cmd/juju/authorizedkeys_add.go 2014-04-25 11:00:53 +0000 | |||
40 | @@ -14,7 +14,7 @@ | |||
41 | 14 | ) | 14 | ) |
42 | 15 | 15 | ||
43 | 16 | var addKeysDoc = ` | 16 | var addKeysDoc = ` |
45 | 17 | Add new authorised ssh keys to allow the holder of those keys to log on to Juju nodes or machines. | 17 | Add new authorized ssh keys to allow the holder of those keys to log on to Juju nodes or machines. |
46 | 18 | ` | 18 | ` |
47 | 19 | 19 | ||
48 | 20 | // AddKeysCommand is used to add a new authorized ssh key for a user. | 20 | // AddKeysCommand is used to add a new authorized ssh key for a user. |
49 | 21 | 21 | ||
50 | === renamed file 'cmd/juju/authorisedkeys_delete.go' => 'cmd/juju/authorizedkeys_delete.go' | |||
51 | --- cmd/juju/authorisedkeys_delete.go 2013-12-13 06:53:01 +0000 | |||
52 | +++ cmd/juju/authorizedkeys_delete.go 2014-04-25 11:00:53 +0000 | |||
53 | @@ -14,7 +14,7 @@ | |||
54 | 14 | ) | 14 | ) |
55 | 15 | 15 | ||
56 | 16 | var deleteKeysDoc = ` | 16 | var deleteKeysDoc = ` |
58 | 17 | Delete existing authorised ssh keys to remove ssh access for the holder of those keys. | 17 | Delete existing authorized ssh keys to remove ssh access for the holder of those keys. |
59 | 18 | The keys to delete are found by specifying either the "comment" portion of the ssh key, | 18 | The keys to delete are found by specifying either the "comment" portion of the ssh key, |
60 | 19 | typically something like "user@host", or the key fingerprint found by using ssh-keygen. | 19 | typically something like "user@host", or the key fingerprint found by using ssh-keygen. |
61 | 20 | ` | 20 | ` |
62 | 21 | 21 | ||
63 | === renamed file 'cmd/juju/authorisedkeys_import.go' => 'cmd/juju/authorizedkeys_import.go' | |||
64 | --- cmd/juju/authorisedkeys_import.go 2013-12-13 06:53:01 +0000 | |||
65 | +++ cmd/juju/authorizedkeys_import.go 2014-04-25 11:00:53 +0000 | |||
66 | @@ -14,7 +14,7 @@ | |||
67 | 14 | ) | 14 | ) |
68 | 15 | 15 | ||
69 | 16 | var importKeysDoc = ` | 16 | var importKeysDoc = ` |
71 | 17 | Import new authorised ssh keys to allow the holder of those keys to log on to Juju nodes or machines. | 17 | Import new authorized ssh keys to allow the holder of those keys to log on to Juju nodes or machines. |
72 | 18 | The keys are imported using ssh-import-id. | 18 | The keys are imported using ssh-import-id. |
73 | 19 | ` | 19 | ` |
74 | 20 | 20 | ||
75 | 21 | 21 | ||
76 | === renamed file 'cmd/juju/authorisedkeys_list.go' => 'cmd/juju/authorizedkeys_list.go' | |||
77 | --- cmd/juju/authorisedkeys_list.go 2013-12-12 22:14:52 +0000 | |||
78 | +++ cmd/juju/authorizedkeys_list.go 2014-04-25 11:00:53 +0000 | |||
79 | @@ -15,7 +15,7 @@ | |||
80 | 15 | ) | 15 | ) |
81 | 16 | 16 | ||
82 | 17 | var listKeysDoc = ` | 17 | var listKeysDoc = ` |
84 | 18 | List a user's authorised ssh keys, allowing the holders of those keys to log on to Juju nodes. | 18 | List a user's authorized ssh keys, allowing the holders of those keys to log on to Juju nodes. |
85 | 19 | By default, just the key fingerprint is printed. Use --full to display the entire key. | 19 | By default, just the key fingerprint is printed. Use --full to display the entire key. |
86 | 20 | 20 | ||
87 | 21 | ` | 21 | ` |
88 | @@ -31,7 +31,7 @@ | |||
89 | 31 | return &cmd.Info{ | 31 | return &cmd.Info{ |
90 | 32 | Name: "list", | 32 | Name: "list", |
91 | 33 | Doc: listKeysDoc, | 33 | Doc: listKeysDoc, |
93 | 34 | Purpose: "list authorised ssh keys for a specified user", | 34 | Purpose: "list authorized ssh keys for a specified user", |
94 | 35 | } | 35 | } |
95 | 36 | } | 36 | } |
96 | 37 | 37 | ||
97 | 38 | 38 | ||
98 | === renamed file 'cmd/juju/authorisedkeys_test.go' => 'cmd/juju/authorizedkeys_test.go' | |||
99 | --- cmd/juju/authorisedkeys_test.go 2014-03-12 22:33:09 +0000 | |||
100 | +++ cmd/juju/authorizedkeys_test.go 2014-04-25 11:00:53 +0000 | |||
101 | @@ -18,12 +18,12 @@ | |||
102 | 18 | sshtesting "launchpad.net/juju-core/utils/ssh/testing" | 18 | sshtesting "launchpad.net/juju-core/utils/ssh/testing" |
103 | 19 | ) | 19 | ) |
104 | 20 | 20 | ||
106 | 21 | type AuthorisedKeysSuite struct { | 21 | type AuthorizedKeysSuite struct { |
107 | 22 | testbase.LoggingSuite | 22 | testbase.LoggingSuite |
108 | 23 | jujuHome *coretesting.FakeHome | 23 | jujuHome *coretesting.FakeHome |
109 | 24 | } | 24 | } |
110 | 25 | 25 | ||
112 | 26 | var _ = gc.Suite(&AuthorisedKeysSuite{}) | 26 | var _ = gc.Suite(&AuthorizedKeysSuite{}) |
113 | 27 | 27 | ||
114 | 28 | var authKeysCommandNames = []string{ | 28 | var authKeysCommandNames = []string{ |
115 | 29 | "add", | 29 | "add", |
116 | @@ -33,20 +33,20 @@ | |||
117 | 33 | "list", | 33 | "list", |
118 | 34 | } | 34 | } |
119 | 35 | 35 | ||
121 | 36 | func (s *AuthorisedKeysSuite) SetUpTest(c *gc.C) { | 36 | func (s *AuthorizedKeysSuite) SetUpTest(c *gc.C) { |
122 | 37 | s.LoggingSuite.SetUpTest(c) | 37 | s.LoggingSuite.SetUpTest(c) |
123 | 38 | s.jujuHome = coretesting.MakeEmptyFakeHome(c) | 38 | s.jujuHome = coretesting.MakeEmptyFakeHome(c) |
124 | 39 | } | 39 | } |
125 | 40 | 40 | ||
127 | 41 | func (s *AuthorisedKeysSuite) TearDownTest(c *gc.C) { | 41 | func (s *AuthorizedKeysSuite) TearDownTest(c *gc.C) { |
128 | 42 | s.jujuHome.Restore() | 42 | s.jujuHome.Restore() |
129 | 43 | s.LoggingSuite.TearDownTest(c) | 43 | s.LoggingSuite.TearDownTest(c) |
130 | 44 | } | 44 | } |
131 | 45 | 45 | ||
133 | 46 | func (s *AuthorisedKeysSuite) TestHelpCommands(c *gc.C) { | 46 | func (s *AuthorizedKeysSuite) TestHelpCommands(c *gc.C) { |
134 | 47 | // Check that we have correctly registered all the sub commands | 47 | // Check that we have correctly registered all the sub commands |
135 | 48 | // by checking the help output. | 48 | // by checking the help output. |
137 | 49 | out := badrun(c, 0, "authorised-keys", "--help") | 49 | out := badrun(c, 0, "authorized-keys", "--help") |
138 | 50 | lines := strings.Split(out, "\n") | 50 | lines := strings.Split(out, "\n") |
139 | 51 | var names []string | 51 | var names []string |
140 | 52 | subcommandsFound := false | 52 | subcommandsFound := false |
141 | @@ -65,29 +65,29 @@ | |||
142 | 65 | c.Assert(names, gc.DeepEquals, authKeysCommandNames) | 65 | c.Assert(names, gc.DeepEquals, authKeysCommandNames) |
143 | 66 | } | 66 | } |
144 | 67 | 67 | ||
146 | 68 | func (s *AuthorisedKeysSuite) assertHelpOutput(c *gc.C, cmd, args string) { | 68 | func (s *AuthorizedKeysSuite) assertHelpOutput(c *gc.C, cmd, args string) { |
147 | 69 | if args != "" { | 69 | if args != "" { |
148 | 70 | args = " " + args | 70 | args = " " + args |
149 | 71 | } | 71 | } |
152 | 72 | expected := fmt.Sprintf("usage: juju authorised-keys %s [options]%s", cmd, args) | 72 | expected := fmt.Sprintf("usage: juju authorized-keys %s [options]%s", cmd, args) |
153 | 73 | out := badrun(c, 0, "authorised-keys", cmd, "--help") | 73 | out := badrun(c, 0, "authorized-keys", cmd, "--help") |
154 | 74 | lines := strings.Split(out, "\n") | 74 | lines := strings.Split(out, "\n") |
155 | 75 | c.Assert(lines[0], gc.Equals, expected) | 75 | c.Assert(lines[0], gc.Equals, expected) |
156 | 76 | } | 76 | } |
157 | 77 | 77 | ||
159 | 78 | func (s *AuthorisedKeysSuite) TestHelpList(c *gc.C) { | 78 | func (s *AuthorizedKeysSuite) TestHelpList(c *gc.C) { |
160 | 79 | s.assertHelpOutput(c, "list", "") | 79 | s.assertHelpOutput(c, "list", "") |
161 | 80 | } | 80 | } |
162 | 81 | 81 | ||
164 | 82 | func (s *AuthorisedKeysSuite) TestHelpAdd(c *gc.C) { | 82 | func (s *AuthorizedKeysSuite) TestHelpAdd(c *gc.C) { |
165 | 83 | s.assertHelpOutput(c, "add", "<ssh key> [...]") | 83 | s.assertHelpOutput(c, "add", "<ssh key> [...]") |
166 | 84 | } | 84 | } |
167 | 85 | 85 | ||
169 | 86 | func (s *AuthorisedKeysSuite) TestHelpDelete(c *gc.C) { | 86 | func (s *AuthorizedKeysSuite) TestHelpDelete(c *gc.C) { |
170 | 87 | s.assertHelpOutput(c, "delete", "<ssh key id> [...]") | 87 | s.assertHelpOutput(c, "delete", "<ssh key id> [...]") |
171 | 88 | } | 88 | } |
172 | 89 | 89 | ||
174 | 90 | func (s *AuthorisedKeysSuite) TestHelpImport(c *gc.C) { | 90 | func (s *AuthorizedKeysSuite) TestHelpImport(c *gc.C) { |
175 | 91 | s.assertHelpOutput(c, "import", "<ssh key id> [...]") | 91 | s.assertHelpOutput(c, "import", "<ssh key id> [...]") |
176 | 92 | } | 92 | } |
177 | 93 | 93 | ||
178 | @@ -100,7 +100,7 @@ | |||
179 | 100 | s.PatchEnvironment(osenv.JujuEnvEnvKey, "dummyenv") | 100 | s.PatchEnvironment(osenv.JujuEnvEnvKey, "dummyenv") |
180 | 101 | } | 101 | } |
181 | 102 | 102 | ||
183 | 103 | func (s *keySuiteBase) setAuthorisedKeys(c *gc.C, keys ...string) { | 103 | func (s *keySuiteBase) setAuthorizedKeys(c *gc.C, keys ...string) { |
184 | 104 | keyString := strings.Join(keys, "\n") | 104 | keyString := strings.Join(keys, "\n") |
185 | 105 | err := s.State.UpdateEnvironConfig(map[string]interface{}{"authorized-keys": keyString}, nil, nil) | 105 | err := s.State.UpdateEnvironConfig(map[string]interface{}{"authorized-keys": keyString}, nil, nil) |
186 | 106 | c.Assert(err, gc.IsNil) | 106 | c.Assert(err, gc.IsNil) |
187 | @@ -125,7 +125,7 @@ | |||
188 | 125 | func (s *ListKeysSuite) TestListKeys(c *gc.C) { | 125 | func (s *ListKeysSuite) TestListKeys(c *gc.C) { |
189 | 126 | key1 := sshtesting.ValidKeyOne.Key + " user@host" | 126 | key1 := sshtesting.ValidKeyOne.Key + " user@host" |
190 | 127 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" | 127 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" |
192 | 128 | s.setAuthorisedKeys(c, key1, key2) | 128 | s.setAuthorizedKeys(c, key1, key2) |
193 | 129 | 129 | ||
194 | 130 | context, err := coretesting.RunCommand(c, &ListKeysCommand{}, []string{}) | 130 | context, err := coretesting.RunCommand(c, &ListKeysCommand{}, []string{}) |
195 | 131 | c.Assert(err, gc.IsNil) | 131 | c.Assert(err, gc.IsNil) |
196 | @@ -137,7 +137,7 @@ | |||
197 | 137 | func (s *ListKeysSuite) TestListFullKeys(c *gc.C) { | 137 | func (s *ListKeysSuite) TestListFullKeys(c *gc.C) { |
198 | 138 | key1 := sshtesting.ValidKeyOne.Key + " user@host" | 138 | key1 := sshtesting.ValidKeyOne.Key + " user@host" |
199 | 139 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" | 139 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" |
201 | 140 | s.setAuthorisedKeys(c, key1, key2) | 140 | s.setAuthorizedKeys(c, key1, key2) |
202 | 141 | 141 | ||
203 | 142 | context, err := coretesting.RunCommand(c, &ListKeysCommand{}, []string{"--full"}) | 142 | context, err := coretesting.RunCommand(c, &ListKeysCommand{}, []string{"--full"}) |
204 | 143 | c.Assert(err, gc.IsNil) | 143 | c.Assert(err, gc.IsNil) |
205 | @@ -149,7 +149,7 @@ | |||
206 | 149 | func (s *ListKeysSuite) TestListKeysNonDefaultUser(c *gc.C) { | 149 | func (s *ListKeysSuite) TestListKeysNonDefaultUser(c *gc.C) { |
207 | 150 | key1 := sshtesting.ValidKeyOne.Key + " user@host" | 150 | key1 := sshtesting.ValidKeyOne.Key + " user@host" |
208 | 151 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" | 151 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" |
210 | 152 | s.setAuthorisedKeys(c, key1, key2) | 152 | s.setAuthorizedKeys(c, key1, key2) |
211 | 153 | _, err := s.State.AddUser("fred", "password") | 153 | _, err := s.State.AddUser("fred", "password") |
212 | 154 | c.Assert(err, gc.IsNil) | 154 | c.Assert(err, gc.IsNil) |
213 | 155 | 155 | ||
214 | @@ -173,7 +173,7 @@ | |||
215 | 173 | 173 | ||
216 | 174 | func (s *AddKeySuite) TestAddKey(c *gc.C) { | 174 | func (s *AddKeySuite) TestAddKey(c *gc.C) { |
217 | 175 | key1 := sshtesting.ValidKeyOne.Key + " user@host" | 175 | key1 := sshtesting.ValidKeyOne.Key + " user@host" |
219 | 176 | s.setAuthorisedKeys(c, key1) | 176 | s.setAuthorizedKeys(c, key1) |
220 | 177 | 177 | ||
221 | 178 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" | 178 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" |
222 | 179 | context, err := coretesting.RunCommand(c, &AddKeysCommand{}, []string{key2, "invalid-key"}) | 179 | context, err := coretesting.RunCommand(c, &AddKeysCommand{}, []string{key2, "invalid-key"}) |
223 | @@ -184,7 +184,7 @@ | |||
224 | 184 | 184 | ||
225 | 185 | func (s *AddKeySuite) TestAddKeyNonDefaultUser(c *gc.C) { | 185 | func (s *AddKeySuite) TestAddKeyNonDefaultUser(c *gc.C) { |
226 | 186 | key1 := sshtesting.ValidKeyOne.Key + " user@host" | 186 | key1 := sshtesting.ValidKeyOne.Key + " user@host" |
228 | 187 | s.setAuthorisedKeys(c, key1) | 187 | s.setAuthorizedKeys(c, key1) |
229 | 188 | _, err := s.State.AddUser("fred", "password") | 188 | _, err := s.State.AddUser("fred", "password") |
230 | 189 | c.Assert(err, gc.IsNil) | 189 | c.Assert(err, gc.IsNil) |
231 | 190 | 190 | ||
232 | @@ -204,7 +204,7 @@ | |||
233 | 204 | func (s *DeleteKeySuite) TestDeleteKeys(c *gc.C) { | 204 | func (s *DeleteKeySuite) TestDeleteKeys(c *gc.C) { |
234 | 205 | key1 := sshtesting.ValidKeyOne.Key + " user@host" | 205 | key1 := sshtesting.ValidKeyOne.Key + " user@host" |
235 | 206 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" | 206 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" |
237 | 207 | s.setAuthorisedKeys(c, key1, key2) | 207 | s.setAuthorizedKeys(c, key1, key2) |
238 | 208 | 208 | ||
239 | 209 | context, err := coretesting.RunCommand( | 209 | context, err := coretesting.RunCommand( |
240 | 210 | c, &DeleteKeysCommand{}, []string{sshtesting.ValidKeyTwo.Fingerprint, "invalid-key"}) | 210 | c, &DeleteKeysCommand{}, []string{sshtesting.ValidKeyTwo.Fingerprint, "invalid-key"}) |
241 | @@ -216,7 +216,7 @@ | |||
242 | 216 | func (s *DeleteKeySuite) TestDeleteKeyNonDefaultUser(c *gc.C) { | 216 | func (s *DeleteKeySuite) TestDeleteKeyNonDefaultUser(c *gc.C) { |
243 | 217 | key1 := sshtesting.ValidKeyOne.Key + " user@host" | 217 | key1 := sshtesting.ValidKeyOne.Key + " user@host" |
244 | 218 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" | 218 | key2 := sshtesting.ValidKeyTwo.Key + " another@host" |
246 | 219 | s.setAuthorisedKeys(c, key1, key2) | 219 | s.setAuthorizedKeys(c, key1, key2) |
247 | 220 | _, err := s.State.AddUser("fred", "password") | 220 | _, err := s.State.AddUser("fred", "password") |
248 | 221 | c.Assert(err, gc.IsNil) | 221 | c.Assert(err, gc.IsNil) |
249 | 222 | 222 | ||
250 | @@ -240,7 +240,7 @@ | |||
251 | 240 | 240 | ||
252 | 241 | func (s *ImportKeySuite) TestImportKeys(c *gc.C) { | 241 | func (s *ImportKeySuite) TestImportKeys(c *gc.C) { |
253 | 242 | key1 := sshtesting.ValidKeyOne.Key + " user@host" | 242 | key1 := sshtesting.ValidKeyOne.Key + " user@host" |
255 | 243 | s.setAuthorisedKeys(c, key1) | 243 | s.setAuthorizedKeys(c, key1) |
256 | 244 | 244 | ||
257 | 245 | context, err := coretesting.RunCommand(c, &ImportKeysCommand{}, []string{"lp:validuser", "invalid-key"}) | 245 | context, err := coretesting.RunCommand(c, &ImportKeysCommand{}, []string{"lp:validuser", "invalid-key"}) |
258 | 246 | c.Assert(err, gc.IsNil) | 246 | c.Assert(err, gc.IsNil) |
259 | @@ -250,7 +250,7 @@ | |||
260 | 250 | 250 | ||
261 | 251 | func (s *ImportKeySuite) TestImportKeyNonDefaultUser(c *gc.C) { | 251 | func (s *ImportKeySuite) TestImportKeyNonDefaultUser(c *gc.C) { |
262 | 252 | key1 := sshtesting.ValidKeyOne.Key + " user@host" | 252 | key1 := sshtesting.ValidKeyOne.Key + " user@host" |
264 | 253 | s.setAuthorisedKeys(c, key1) | 253 | s.setAuthorizedKeys(c, key1) |
265 | 254 | _, err := s.State.AddUser("fred", "password") | 254 | _, err := s.State.AddUser("fred", "password") |
266 | 255 | c.Assert(err, gc.IsNil) | 255 | c.Assert(err, gc.IsNil) |
267 | 256 | 256 | ||
268 | 257 | 257 | ||
269 | === modified file 'cmd/juju/help_topics.go' | |||
270 | --- cmd/juju/help_topics.go 2014-03-17 20:03:47 +0000 | |||
271 | +++ cmd/juju/help_topics.go 2014-04-25 11:00:53 +0000 | |||
272 | @@ -50,14 +50,14 @@ | |||
273 | 50 | const helpLocalProvider = ` | 50 | const helpLocalProvider = ` |
274 | 51 | The local provider is a Linux-only Juju environment that uses LXC containers as | 51 | The local provider is a Linux-only Juju environment that uses LXC containers as |
275 | 52 | a virtual cloud on the local machine. Because of this, lxc and mongodb are | 52 | a virtual cloud on the local machine. Because of this, lxc and mongodb are |
278 | 53 | required for the local provider to work. If you don't already have lxc and | 53 | required for the local provider to work. All of these dependencies are tracked |
279 | 54 | mongodb installed, run the following commands: | 54 | in the 'juju-local' package. You can install that with: |
280 | 55 | 55 | ||
281 | 56 | sudo apt-get update | 56 | sudo apt-get update |
283 | 57 | sudo apt-get install lxc mongodb-server | 57 | sudo apt-get install juju-local |
284 | 58 | 58 | ||
287 | 59 | After that you might get error for SSH authorized/public key not found. ERROR | 59 | After that you might get error for SSH authorised/public key not found. ERROR |
288 | 60 | SSH authorized/public key not found. | 60 | SSH authorised/public key not found. |
289 | 61 | 61 | ||
290 | 62 | ssh-keygen -t rsa | 62 | ssh-keygen -t rsa |
291 | 63 | 63 | ||
292 | 64 | 64 | ||
293 | === modified file 'cmd/juju/main.go' | |||
294 | --- cmd/juju/main.go 2014-03-26 13:40:28 +0000 | |||
295 | +++ cmd/juju/main.go 2014-04-25 11:00:53 +0000 | |||
296 | @@ -122,8 +122,8 @@ | |||
297 | 122 | // Charm tool commands. | 122 | // Charm tool commands. |
298 | 123 | jujucmd.Register(wrap(&HelpToolCommand{})) | 123 | jujucmd.Register(wrap(&HelpToolCommand{})) |
299 | 124 | 124 | ||
302 | 125 | // Manage authorised ssh keys. | 125 | // Manage authorized ssh keys. |
303 | 126 | jujucmd.Register(wrap(NewAuthorisedKeysCommand())) | 126 | jujucmd.Register(wrap(NewAuthorizedKeysCommand())) |
304 | 127 | 127 | ||
305 | 128 | // Common commands. | 128 | // Common commands. |
306 | 129 | jujucmd.Register(wrap(&cmd.VersionCommand{})) | 129 | jujucmd.Register(wrap(&cmd.VersionCommand{})) |
307 | 130 | 130 | ||
308 | === modified file 'cmd/juju/main_test.go' | |||
309 | --- cmd/juju/main_test.go 2014-03-26 13:40:28 +0000 | |||
310 | +++ cmd/juju/main_test.go 2014-04-25 11:00:53 +0000 | |||
311 | @@ -213,7 +213,8 @@ | |||
312 | 213 | "add-relation", | 213 | "add-relation", |
313 | 214 | "add-unit", | 214 | "add-unit", |
314 | 215 | "api-endpoints", | 215 | "api-endpoints", |
316 | 216 | "authorised-keys", | 216 | "authorised-keys", // alias for authorized-keys |
317 | 217 | "authorized-keys", | ||
318 | 217 | "bootstrap", | 218 | "bootstrap", |
319 | 218 | "debug-hooks", | 219 | "debug-hooks", |
320 | 219 | "debug-log", | 220 | "debug-log", |
321 | 220 | 221 | ||
322 | === modified file 'cmd/supercommand.go' | |||
323 | --- cmd/supercommand.go 2014-03-20 06:01:50 +0000 | |||
324 | +++ cmd/supercommand.go 2014-04-25 11:00:53 +0000 | |||
325 | @@ -48,6 +48,7 @@ | |||
326 | 48 | Doc string | 48 | Doc string |
327 | 49 | Log *Log | 49 | Log *Log |
328 | 50 | MissingCallback MissingCallback | 50 | MissingCallback MissingCallback |
329 | 51 | Aliases []string | ||
330 | 51 | } | 52 | } |
331 | 52 | 53 | ||
332 | 53 | // NewSuperCommand creates and initializes a new `SuperCommand`, and returns | 54 | // NewSuperCommand creates and initializes a new `SuperCommand`, and returns |
333 | @@ -59,7 +60,9 @@ | |||
334 | 59 | Doc: params.Doc, | 60 | Doc: params.Doc, |
335 | 60 | Log: params.Log, | 61 | Log: params.Log, |
336 | 61 | usagePrefix: params.UsagePrefix, | 62 | usagePrefix: params.UsagePrefix, |
338 | 62 | missingCallback: params.MissingCallback} | 63 | missingCallback: params.MissingCallback, |
339 | 64 | Aliases: params.Aliases, | ||
340 | 65 | } | ||
341 | 63 | command.init() | 66 | command.init() |
342 | 64 | return command | 67 | return command |
343 | 65 | } | 68 | } |
344 | @@ -74,6 +77,7 @@ | |||
345 | 74 | Purpose string | 77 | Purpose string |
346 | 75 | Doc string | 78 | Doc string |
347 | 76 | Log *Log | 79 | Log *Log |
348 | 80 | Aliases []string | ||
349 | 77 | usagePrefix string | 81 | usagePrefix string |
350 | 78 | subcmds map[string]Command | 82 | subcmds map[string]Command |
351 | 79 | commonflags *gnuflag.FlagSet | 83 | commonflags *gnuflag.FlagSet |
352 | @@ -186,6 +190,7 @@ | |||
353 | 186 | Args: "<command> ...", | 190 | Args: "<command> ...", |
354 | 187 | Purpose: c.Purpose, | 191 | Purpose: c.Purpose, |
355 | 188 | Doc: strings.Join(docParts, "\n\n"), | 192 | Doc: strings.Join(docParts, "\n\n"), |
356 | 193 | Aliases: c.Aliases, | ||
357 | 189 | } | 194 | } |
358 | 190 | } | 195 | } |
359 | 191 | 196 | ||
360 | 192 | 197 | ||
361 | === modified file 'cmd/supercommand_test.go' | |||
362 | --- cmd/supercommand_test.go 2014-03-20 09:12:53 +0000 | |||
363 | +++ cmd/supercommand_test.go 2014-04-25 11:00:53 +0000 | |||
364 | @@ -264,3 +264,26 @@ | |||
365 | 264 | c.Assert(testing.Stdout(ctx), gc.Equals, "this is std out") | 264 | c.Assert(testing.Stdout(ctx), gc.Equals, "this is std out") |
366 | 265 | c.Assert(testing.Stderr(ctx), gc.Equals, "this is std err") | 265 | c.Assert(testing.Stderr(ctx), gc.Equals, "this is std err") |
367 | 266 | } | 266 | } |
368 | 267 | |||
369 | 268 | func (s *SuperCommandSuite) TestSupercommandAliases(c *gc.C) { | ||
370 | 269 | jc := cmd.NewSuperCommand(cmd.SuperCommandParams{ | ||
371 | 270 | Name: "jujutest", | ||
372 | 271 | UsagePrefix: "juju", | ||
373 | 272 | }) | ||
374 | 273 | sub := cmd.NewSuperCommand(cmd.SuperCommandParams{ | ||
375 | 274 | Name: "jubar", | ||
376 | 275 | UsagePrefix: "juju jujutest", | ||
377 | 276 | Aliases: []string{"jubaz", "jubing"}, | ||
378 | 277 | }) | ||
379 | 278 | info := sub.Info() | ||
380 | 279 | c.Check(info.Aliases, gc.DeepEquals, []string{"jubaz", "jubing"}) | ||
381 | 280 | jc.Register(sub) | ||
382 | 281 | for _, name := range []string{"jubar", "jubaz", "jubing"} { | ||
383 | 282 | c.Logf("testing command name %q", name) | ||
384 | 283 | ctx := testing.Context(c) | ||
385 | 284 | code := cmd.Main(jc, ctx, []string{name, "--help"}) | ||
386 | 285 | c.Assert(code, gc.Equals, 0) | ||
387 | 286 | stripped := strings.Replace(bufferString(ctx.Stdout), "\n", "", -1) | ||
388 | 287 | c.Assert(stripped, gc.Matches, ".*usage: juju jujutest jubar.*aliases: jubaz, jubing") | ||
389 | 288 | } | ||
390 | 289 | } |