Skip to content

Commit 7b65e9c

Browse files
Merge pull request #1377 from caberos/issue1372
Remove the `-a` option from `slcli user create`
2 parents 4e6cb6d + e1d1857 commit 7b65e9c

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

Diff for: SoftLayer/CLI/user/create.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@
2929
"supersedes this template.")
3030
@click.option('--template', '-t', default=None,
3131
help="A json string describing https://softlayer.github.io/reference/datatypes/SoftLayer_User_Customer/")
32-
@click.option('--api-key', '-a', default=False, is_flag=True, help="Create an API key for this user.")
3332
@environment.pass_env
34-
def cli(env, username, email, password, from_user, template, api_key):
33+
def cli(env, username, email, password, from_user, template):
3534
"""Creates a user Users.
3635
3736
Remember to set the permissions and access for this new user.
@@ -81,13 +80,9 @@ def cli(env, username, email, password, from_user, template, api_key):
8180
raise exceptions.CLIAbort("Canceling creation!")
8281

8382
result = mgr.create_user(user_template, password)
84-
new_api_key = None
85-
if api_key:
86-
click.secho("Adding API key...", fg='green')
87-
new_api_key = mgr.add_api_authentication_key(result['id'])
8883

89-
table = formatting.Table(['Username', 'Email', 'Password', 'API Key'])
90-
table.add_row([result['username'], result['email'], password, new_api_key])
84+
table = formatting.Table(['Username', 'Email', 'Password'])
85+
table.add_row([result['username'], result['email'], password])
9186
env.fout(table)
9287

9388

Diff for: tests/CLI/modules/user_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,8 @@ def test_create_user_generate_password_2(self, confirm_mock):
194194
@mock.patch('SoftLayer.CLI.formatting.confirm')
195195
def test_create_user_and_apikey(self, confirm_mock):
196196
confirm_mock.return_value = True
197-
result = self.run_command(['user', 'create', 'test', '-e', '[email protected]', '-a'])
197+
result = self.run_command(['user', 'create', 'test', '-e', '[email protected]'])
198198
self.assert_no_fail(result)
199-
self.assert_called_with('SoftLayer_User_Customer', 'addApiAuthenticationKey')
200199

201200
@mock.patch('SoftLayer.CLI.formatting.confirm')
202201
def test_create_user_with_template(self, confirm_mock):

0 commit comments

Comments
 (0)