multicloud-cli 0.9.1__tar.gz → 0.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/PKG-INFO +1 -1
- multicloud_cli-0.9.2/multicloud_cli/__init__.py +1 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/cloud_account.py +18 -2
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_cloud_account.py +31 -0
- multicloud_cli-0.9.1/multicloud_cli/__init__.py +0 -1
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/.gitignore +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/LICENSE +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/README.md +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/account.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/api.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/auth.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/catalog.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/config.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/duration.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/exitcodes.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/extend.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/main.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/net.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/node.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/orgopt.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/output.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/pool.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/ssh.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/ssh_cert.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/sso.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/multicloud_cli/version_check.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/pyproject.toml +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/__init__.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/conftest.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/helpers.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_account_extend.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_apply.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_auth.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_catalog.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_conventions.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_net.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_pool.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_ssh.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_ssh_cert.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_sso.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_sso_session.py +0 -0
- {multicloud_cli-0.9.1 → multicloud_cli-0.9.2}/tests/test_version_check.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: multicloud-cli
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
4
4
|
Summary: mctl: the Multicloud command line: sign in, connect your cloud account, run pools
|
|
5
5
|
Project-URL: Homepage, https://multicloud.io
|
|
6
6
|
Author-email: Multicloud Team <info@multicloud.io>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.9.2"
|
|
@@ -39,7 +39,7 @@ _LOCATION_LINE = re.compile(r'^(\s*location\s*=\s*)"[^"\n]*"', re.M)
|
|
|
39
39
|
#: The API snippet has no provider block, and azurerm needs one (features {}, the subscription).
|
|
40
40
|
#: Same as deploy/customer-terraform/examples/azure/main.tf.
|
|
41
41
|
AZURE_HEADER = """terraform {{
|
|
42
|
-
required_version = ">= 1.
|
|
42
|
+
required_version = ">= 1.10.0"
|
|
43
43
|
|
|
44
44
|
required_providers {{
|
|
45
45
|
azurerm = {{
|
|
@@ -56,8 +56,10 @@ provider "azurerm" {{
|
|
|
56
56
|
|
|
57
57
|
subscription_id = "{subscription}"
|
|
58
58
|
|
|
59
|
-
#
|
|
59
|
+
# Register only the four resource providers that Multicloud needs. The provider registers a missing
|
|
60
|
+
# one and never unregisters one. Without "none" it would register a long list first.
|
|
60
61
|
resource_provider_registrations = "none"
|
|
62
|
+
resource_providers_to_register = ["Microsoft.Compute", "Microsoft.ManagedIdentity", "Microsoft.Network", "Microsoft.Quota"]
|
|
61
63
|
}}
|
|
62
64
|
|
|
63
65
|
"""
|
|
@@ -892,10 +894,24 @@ def disconnect(ctx, account_id, yes, wait, timeout):
|
|
|
892
894
|
click.echo("Next: remove the Multicloud managed identity and role from the subscription. Run 'tofu destroy' "
|
|
893
895
|
f"(or 'terraform destroy') in the folder with {TF_FILE}.")
|
|
894
896
|
return
|
|
897
|
+
if data.get("cloud") == "AWS" and _module_before_2(data.get("module_version")):
|
|
898
|
+
click.echo(f"First: in the folder with {TF_FILE}, change the module version to 2.0.0, run 'tofu init -upgrade' "
|
|
899
|
+
"(or 'terraform init -upgrade'), then plan and apply. The plan must show the three service-linked "
|
|
900
|
+
"roles as forgotten and nothing to destroy. Module " + str(data.get("module_version")) + " deletes "
|
|
901
|
+
"the EC2 Spot, EC2 Fleet and Service Quotas service-linked roles of the account on destroy; 2.0.0 "
|
|
902
|
+
"keeps them.")
|
|
895
903
|
click.echo("Next: remove the Multicloud role from the account. Run 'tofu destroy' (or 'terraform destroy') in "
|
|
896
904
|
f"the folder with {TF_FILE}, or 'mctl cloud-account destroy {account_id}' if mctl created the AWS account.")
|
|
897
905
|
|
|
898
906
|
|
|
907
|
+
def _module_before_2(version) -> bool:
|
|
908
|
+
"""The AWS module before 2.0.0 deletes the account's service-linked roles on destroy. Unknown: False."""
|
|
909
|
+
try:
|
|
910
|
+
return int(str(version).strip().lstrip("vV").split(".")[0]) < 2
|
|
911
|
+
except (TypeError, ValueError):
|
|
912
|
+
return False
|
|
913
|
+
|
|
914
|
+
|
|
899
915
|
def _find_tool(requested: Optional[str]) -> str:
|
|
900
916
|
if requested:
|
|
901
917
|
if not shutil.which(requested):
|
|
@@ -592,6 +592,8 @@ def test_create_azure_sends_the_subscription_and_writes_a_runnable_file(tmp_path
|
|
|
592
592
|
assert 'provider "azurerm" {' in tf and "features {}" in tf
|
|
593
593
|
assert f'subscription_id = "{AZ_SUB}"' in tf
|
|
594
594
|
assert 'resource_provider_registrations = "none"' in tf
|
|
595
|
+
assert ('resource_providers_to_register = ["Microsoft.Compute", "Microsoft.ManagedIdentity", '
|
|
596
|
+
'"Microsoft.Network", "Microsoft.Quota"]') in tf
|
|
595
597
|
assert 'source = "hashicorp/azurerm"' in tf
|
|
596
598
|
assert 'location = "westeurope"' in tf and "REPLACE-WITH" not in tf
|
|
597
599
|
assert tf.count('module "multicloud"') == 1
|
|
@@ -1053,6 +1055,35 @@ def test_disconnect_with_yes_uses_the_sign_in():
|
|
|
1053
1055
|
assert "X-API-Key" not in sent.kwargs["headers"]
|
|
1054
1056
|
assert f"Disconnected: AWS account {ACCT} is no longer connected to Multicloud." in r.stdout
|
|
1055
1057
|
assert "tofu destroy" in r.stdout and "mctl cloud-account destroy 5" in r.stdout
|
|
1058
|
+
assert "First:" not in r.stdout # module version unknown: no upgrade line
|
|
1059
|
+
|
|
1060
|
+
|
|
1061
|
+
def test_disconnect_module_before_2_says_upgrade_before_destroy():
|
|
1062
|
+
old = {**VERIFIED_CONNECTED, "module_version": "1.3.1"}
|
|
1063
|
+
r, _ = invoke_seq(["cloud-account", "disconnect", "5", "--yes"], [reply(200, old), reply(200, REVOKED)])
|
|
1064
|
+
assert r.exit_code == 0, r.output
|
|
1065
|
+
first, nxt = r.stdout.index("First: "), r.stdout.index("Next: remove the Multicloud role")
|
|
1066
|
+
assert first < nxt and "2.0.0" in r.stdout and "init -upgrade" in r.stdout and "nothing to destroy" in r.stdout and "service-linked roles" in r.stdout
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
def test_disconnect_v_prefixed_old_module_still_warns():
|
|
1070
|
+
old = {**VERIFIED_CONNECTED, "module_version": "v1.3.1"}
|
|
1071
|
+
r, _ = invoke_seq(["cloud-account", "disconnect", "5", "--yes"], [reply(200, old), reply(200, REVOKED)])
|
|
1072
|
+
assert "First: " in r.stdout
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
def test_disconnect_gce_old_module_prints_no_aws_upgrade_line():
|
|
1076
|
+
gce = {**VERIFIED_CONNECTED, "cloud": "GCE", "module_version": "1.0.1"}
|
|
1077
|
+
r, _ = invoke_seq(["cloud-account", "disconnect", "5", "--yes"], [reply(200, gce), reply(200, {**gce, "status": "revoked"})])
|
|
1078
|
+
assert r.exit_code == 0, r.output
|
|
1079
|
+
assert "First:" not in r.stdout
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
def test_disconnect_module_2_prints_no_upgrade_line():
|
|
1083
|
+
new = {**VERIFIED_CONNECTED, "module_version": "2.0.0"}
|
|
1084
|
+
r, _ = invoke_seq(["cloud-account", "disconnect", "5", "--yes"], [reply(200, new), reply(200, REVOKED)])
|
|
1085
|
+
assert r.exit_code == 0, r.output
|
|
1086
|
+
assert "First:" not in r.stdout and "tofu destroy" in r.stdout
|
|
1056
1087
|
|
|
1057
1088
|
|
|
1058
1089
|
def test_disconnect_asks_first():
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.9.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|