From 6f58b94b8ded045161b12cf1fd488ca87553d3cc Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Wed, 10 Oct 2018 06:11:47 +0800 Subject: [PATCH 1/2] Update to use click 7 --- SoftLayer/CLI/core.py | 2 +- SoftLayer/CLI/vpn/ipsec/subnet/add.py | 4 +-- SoftLayer/CLI/vpn/ipsec/subnet/remove.py | 2 +- SoftLayer/CLI/vpn/ipsec/update.py | 36 ++++++++++++------------ setup.py | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/SoftLayer/CLI/core.py b/SoftLayer/CLI/core.py index a02bf65a4..a05ffaa54 100644 --- a/SoftLayer/CLI/core.py +++ b/SoftLayer/CLI/core.py @@ -137,7 +137,7 @@ def cli(env, @cli.resultcallback() @environment.pass_env -def output_diagnostics(env, verbose=0, **kwargs): +def output_diagnostics(env, result, verbose=0, **kwargs): """Output diagnostic information.""" if verbose > 0: diff --git a/SoftLayer/CLI/vpn/ipsec/subnet/add.py b/SoftLayer/CLI/vpn/ipsec/subnet/add.py index 438dfc5fc..08d0bc5ec 100644 --- a/SoftLayer/CLI/vpn/ipsec/subnet/add.py +++ b/SoftLayer/CLI/vpn/ipsec/subnet/add.py @@ -18,14 +18,14 @@ type=int, help='Subnet identifier to add') @click.option('-t', - '--type', '--subnet-type', + '--type', required=True, type=click.Choice(['internal', 'remote', 'service']), help='Subnet type to add') @click.option('-n', - '--network', '--network-identifier', + '--network', default=None, type=NetworkParamType(), help='Subnet network identifier to create') diff --git a/SoftLayer/CLI/vpn/ipsec/subnet/remove.py b/SoftLayer/CLI/vpn/ipsec/subnet/remove.py index 2d8b34d9b..41d450a33 100644 --- a/SoftLayer/CLI/vpn/ipsec/subnet/remove.py +++ b/SoftLayer/CLI/vpn/ipsec/subnet/remove.py @@ -16,8 +16,8 @@ type=int, help='Subnet identifier to remove') @click.option('-t', - '--type', '--subnet-type', + '--type', required=True, type=click.Choice(['internal', 'remote', 'service']), help='Subnet type to add') diff --git a/SoftLayer/CLI/vpn/ipsec/update.py b/SoftLayer/CLI/vpn/ipsec/update.py index 68e09b0a9..4056f3b8f 100644 --- a/SoftLayer/CLI/vpn/ipsec/update.py +++ b/SoftLayer/CLI/vpn/ipsec/update.py @@ -20,48 +20,48 @@ @click.option('--preshared-key', default=None, help='Preshared key value') -@click.option('--p1-auth', - '--phase1-auth', +@click.option('--phase1-auth', + '--p1-auth', default=None, type=click.Choice(['MD5', 'SHA1', 'SHA256']), help='Phase 1 authentication value') -@click.option('--p1-crypto', - '--phase1-crypto', +@click.option('--phase1-crypto', + '--p1-crypto', default=None, type=click.Choice(['DES', '3DES', 'AES128', 'AES192', 'AES256']), help='Phase 1 encryption value') -@click.option('--p1-dh', - '--phase1-dh', +@click.option('--phase1-dh', + '--p1-dh', default=None, type=click.Choice(['0', '1', '2', '5']), help='Phase 1 diffie hellman group value') -@click.option('--p1-key-ttl', - '--phase1-key-ttl', +@click.option('--phase1-key-ttl', + '--p1-key-ttl', default=None, type=click.IntRange(120, 172800), help='Phase 1 key life value') -@click.option('--p2-auth', - '--phase2-auth', +@click.option('--phase2-auth', + '--p2-auth', default=None, type=click.Choice(['MD5', 'SHA1', 'SHA256']), help='Phase 2 authentication value') -@click.option('--p2-crypto', - '--phase2-crypto', +@click.option('--phase2-crypto', + '--p2-crypto', default=None, type=click.Choice(['DES', '3DES', 'AES128', 'AES192', 'AES256']), help='Phase 2 encryption value') -@click.option('--p2-dh', - '--phase2-dh', +@click.option('--phase2-dh', + '--p2-dh', default=None, type=click.Choice(['0', '1', '2', '5']), help='Phase 2 diffie hellman group value') -@click.option('--p2-forward-secrecy', - '--phase2-forward-secrecy', +@click.option('--phase2-forward-secrecy', + '--p2-forward-secrecy', default=None, type=click.IntRange(0, 1), help='Phase 2 perfect forward secrecy value') -@click.option('--p2-key-ttl', - '--phase2-key-ttl', +@click.option('--phase2-key-ttl', + '--p2-key-ttl', default=None, type=click.IntRange(120, 172800), help='Phase 2 key life value') diff --git a/setup.py b/setup.py index b0d08fc17..1cca86a2a 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ install_requires=[ 'six >= 1.7.0', 'ptable >= 0.9.2', - 'click >= 5, < 7', + 'click >= 7', 'requests >= 2.18.4', 'prompt_toolkit >= 0.53', 'pygments >= 2.0.0', From 3b7689984d5ddc2d38987f8a0f4caac14c161862 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Wed, 10 Oct 2018 13:04:59 +0800 Subject: [PATCH 2/2] Fix exit code of edit-permissions test --- tests/CLI/modules/user_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CLI/modules/user_tests.py b/tests/CLI/modules/user_tests.py index 0222a62b8..0683ed98f 100644 --- a/tests/CLI/modules/user_tests.py +++ b/tests/CLI/modules/user_tests.py @@ -129,7 +129,7 @@ def test_edit_perms_on(self): def test_edit_perms_on_bad(self): result = self.run_command(['user', 'edit-permissions', '11100', '--enable', '-p', 'TEST_NOt_exist']) - self.assertEqual(result.exit_code, -1) + self.assertEqual(result.exit_code, 1) def test_edit_perms_off(self): result = self.run_command(['user', 'edit-permissions', '11100', '--disable', '-p', 'TEST'])