azure-cli-diff-tool 0.0.8__tar.gz → 0.1.0__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.
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/PKG-INFO +17 -3
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool/__init__.py +2 -2
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool/_const.py +1 -1
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool/data/meta_change_whitelist.txt +4 -3
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool/meta_change_detect.py +21 -7
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool.egg-info/PKG-INFO +17 -3
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool.egg-info/SOURCES.txt +1 -0
- azure_cli_diff_tool-0.1.0/azure_cli_diff_tool.egg-info/requires.txt +2 -0
- azure_cli_diff_tool-0.1.0/pyproject.toml +9 -0
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/setup.py +1 -1
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/tests/test_break_change.py +49 -16
- azure_cli_diff_tool-0.0.8/azure_cli_diff_tool.egg-info/requires.txt +0 -2
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/README.rst +0 -0
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool/data/blob_config.ini +0 -0
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool/meta_change.py +0 -0
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool/utils.py +0 -0
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool.egg-info/dependency_links.txt +0 -0
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool.egg-info/top_level.txt +0 -0
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/setup.cfg +0 -0
- {azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/tests/__init__.py +0 -0
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: azure-cli-diff-tool
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: A tool for cli metadata management
|
|
5
5
|
Author: Microsoft Corporation
|
|
6
6
|
Author-email: azpycli@microsoft.com
|
|
7
7
|
License: MIT
|
|
8
8
|
Requires-Dist: deepdiff==6.3.0
|
|
9
|
-
Requires-Dist: requests
|
|
9
|
+
Requires-Dist: requests~=2.32.3
|
|
10
|
+
Dynamic: author
|
|
11
|
+
Dynamic: author-email
|
|
12
|
+
Dynamic: description
|
|
13
|
+
Dynamic: license
|
|
14
|
+
Dynamic: requires-dist
|
|
15
|
+
Dynamic: summary
|
|
10
16
|
|
|
11
17
|
Microsoft Azure CLI Diff Tools (azure-cli-diff-tool)
|
|
12
18
|
=======================================================
|
|
@@ -98,6 +104,14 @@ License
|
|
|
98
104
|
|
|
99
105
|
Release History
|
|
100
106
|
===============
|
|
107
|
+
0.1.0
|
|
108
|
+
++++++
|
|
109
|
+
* Enable meta-diff with `module_name` excluded
|
|
110
|
+
|
|
111
|
+
0.0.9
|
|
112
|
+
++++++
|
|
113
|
+
* Use dynamic metadata whitelist
|
|
114
|
+
|
|
101
115
|
0.0.8
|
|
102
116
|
++++++
|
|
103
117
|
* Set `deepDiff` un-breaking version
|
|
@@ -18,7 +18,7 @@ from .utils import get_blob_config, load_blob_config_file, get_target_version_mo
|
|
|
18
18
|
extract_module_name_from_meta_file, export_meta_changes_to_csv, export_meta_changes_to_json, \
|
|
19
19
|
export_meta_changes_to_dict, expand_deprecate_obj
|
|
20
20
|
|
|
21
|
-
__VERSION__ = '0.0
|
|
21
|
+
__VERSION__ = '0.1.0'
|
|
22
22
|
|
|
23
23
|
logger = logging.getLogger(__name__)
|
|
24
24
|
|
|
@@ -63,7 +63,7 @@ def meta_diff(base_meta_file, diff_meta_file, only_break=False, output_type="tex
|
|
|
63
63
|
raise Exception("Please update your azure cli diff tool")
|
|
64
64
|
expand_deprecate_obj(command_tree_before)
|
|
65
65
|
expand_deprecate_obj(command_tree_after)
|
|
66
|
-
diff = DeepDiff(command_tree_before, command_tree_after)
|
|
66
|
+
diff = DeepDiff(command_tree_before, command_tree_after, exclude_paths=["root['module_name']"])
|
|
67
67
|
if not diff:
|
|
68
68
|
print(f"No meta diffs from {diff_meta_file} to {base_meta_file}")
|
|
69
69
|
return export_meta_changes_to_json(None, output_file)
|
|
@@ -11,7 +11,7 @@ CONFIG_FILE_PATH = f"{script_directory}/{BLOB_SETTING_CONFIG_FILE}"
|
|
|
11
11
|
|
|
12
12
|
META_CHANDE_WHITELIST_FILE = "./data/meta_change_whitelist.txt"
|
|
13
13
|
META_CHANDE_WHITELIST_FILE_PATH = f"{script_directory}/{META_CHANDE_WHITELIST_FILE}"
|
|
14
|
-
|
|
14
|
+
META_CHANDE_WHITELIST_FILE_URL = "https://azcmdchangemgmt.blob.core.windows.net/azure-cli-diff-tool-config/meta_change_whitelist.txt"
|
|
15
15
|
DOWNLOAD_THREADS = 30
|
|
16
16
|
|
|
17
17
|
BREAKING_CHANE_RULE_LINK_URL_PREFIX = "https://github.com/Azure/azure-cli/blob/dev/doc/breaking_change_rules/"
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
1010 ams asset get-sas-urls expiry_time default
|
|
2
|
+
1010 mariadb server create administrator_login default
|
|
2
3
|
1010 mysql flexible-server create administrator_login default
|
|
3
4
|
1010 mysql flexible-server restore restore_point_in_time default
|
|
4
5
|
1010 mysql flexible-server import create administrator_login default
|
|
6
|
+
1010 mysql flexible-server maintenance reschedule maintenance_start_time default
|
|
7
|
+
1010 mysql server create administrator_login default
|
|
5
8
|
1010 postgres flexible-server create administrator_login default
|
|
6
9
|
1010 postgres flexible-server restore restore_point_in_time default
|
|
7
|
-
1010
|
|
8
|
-
1010 postgres server create administrator_login default
|
|
9
|
-
1010 mariadb server create administrator_login default
|
|
10
|
+
1010 postgres server create administrator_login default
|
{azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool/meta_change_detect.py
RENAMED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# -----------------------------------------------------------------------------
|
|
6
6
|
|
|
7
7
|
import logging
|
|
8
|
+
import requests
|
|
8
9
|
import os.path
|
|
9
10
|
|
|
10
11
|
from .utils import get_command_tree, ChangeType, extract_cmd_name, extract_subgroup_name, extract_subgroup_property, \
|
|
@@ -22,6 +23,7 @@ from ._const import (SUBGROUP_PROPERTY_ADD_BREAK_LIST, SUBGROUP_PROPERTY_ADD_WAR
|
|
|
22
23
|
PARA_PROPERTY_ADD_BREAK_LIST, PARA_PROPERTY_ADD_WARN_LIST,
|
|
23
24
|
PARA_PROPERTY_UPDATE_BREAK_LIST, PARA_PROPERTY_UPDATE_WARN_LIST,
|
|
24
25
|
CMD_REMOVE_SUFFIX_WARN_LIST,
|
|
26
|
+
META_CHANDE_WHITELIST_FILE_URL,
|
|
25
27
|
META_CHANDE_WHITELIST_FILE_PATH)
|
|
26
28
|
|
|
27
29
|
logger = logging.getLogger(__name__)
|
|
@@ -43,8 +45,10 @@ class MetaChangeDetect:
|
|
|
43
45
|
self.deep_diff = deep_diff
|
|
44
46
|
else:
|
|
45
47
|
logger.info("None diffs from cmd meta json")
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
if base_meta["module_name"] != diff_meta["module_name"]:
|
|
49
|
+
print(f'Comparing two modules with different name, base mod: {base_meta["module_name"]},'
|
|
50
|
+
f' diff mod: {diff_meta["module_name"]}')
|
|
51
|
+
self.module_name = diff_meta["module_name"]
|
|
48
52
|
self.base_meta = base_meta
|
|
49
53
|
self.diff_meta = diff_meta
|
|
50
54
|
self.diff_objs = []
|
|
@@ -53,14 +57,24 @@ class MetaChangeDetect:
|
|
|
53
57
|
self.__get_meta_change_whitelist__()
|
|
54
58
|
|
|
55
59
|
def __get_meta_change_whitelist__(self):
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
remote_res = requests.get(META_CHANDE_WHITELIST_FILE_URL)
|
|
61
|
+
if remote_res.status_code != 200:
|
|
62
|
+
logger.warning("remote meta change whitelist fetch error, use local dict")
|
|
63
|
+
if not os.path.exists(META_CHANDE_WHITELIST_FILE_PATH):
|
|
64
|
+
logger.info("meta_change_whitelist.txt not exist, skipped")
|
|
65
|
+
return
|
|
66
|
+
with open(META_CHANDE_WHITELIST_FILE_PATH, "r") as f_in:
|
|
67
|
+
for line in f_in:
|
|
68
|
+
white_key = line.rstrip()
|
|
69
|
+
self.meta_change_whitelist.add(white_key)
|
|
70
|
+
else:
|
|
71
|
+
logger.info("remote meta change whitelist fetch success")
|
|
72
|
+
content = remote_res.text
|
|
73
|
+
for line in content.split("\n"):
|
|
61
74
|
white_key = line.rstrip()
|
|
62
75
|
self.meta_change_whitelist.add(white_key)
|
|
63
76
|
|
|
77
|
+
|
|
64
78
|
@staticmethod
|
|
65
79
|
def __search_cmd_obj(cmd_name, search_meta):
|
|
66
80
|
command_tree = get_command_tree(cmd_name)
|
{azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool.egg-info/PKG-INFO
RENAMED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: azure-cli-diff-tool
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 0.1.0
|
|
4
4
|
Summary: A tool for cli metadata management
|
|
5
5
|
Author: Microsoft Corporation
|
|
6
6
|
Author-email: azpycli@microsoft.com
|
|
7
7
|
License: MIT
|
|
8
8
|
Requires-Dist: deepdiff==6.3.0
|
|
9
|
-
Requires-Dist: requests
|
|
9
|
+
Requires-Dist: requests~=2.32.3
|
|
10
|
+
Dynamic: author
|
|
11
|
+
Dynamic: author-email
|
|
12
|
+
Dynamic: description
|
|
13
|
+
Dynamic: license
|
|
14
|
+
Dynamic: requires-dist
|
|
15
|
+
Dynamic: summary
|
|
10
16
|
|
|
11
17
|
Microsoft Azure CLI Diff Tools (azure-cli-diff-tool)
|
|
12
18
|
=======================================================
|
|
@@ -98,6 +104,14 @@ License
|
|
|
98
104
|
|
|
99
105
|
Release History
|
|
100
106
|
===============
|
|
107
|
+
0.1.0
|
|
108
|
+
++++++
|
|
109
|
+
* Enable meta-diff with `module_name` excluded
|
|
110
|
+
|
|
111
|
+
0.0.9
|
|
112
|
+
++++++
|
|
113
|
+
* Use dynamic metadata whitelist
|
|
114
|
+
|
|
101
115
|
0.0.8
|
|
102
116
|
++++++
|
|
103
117
|
* Set `deepDiff` un-breaking version
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for
|
|
4
|
+
# license information.
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
[build-system]
|
|
8
|
+
# Minimum requirements for the build system to execute.
|
|
9
|
+
requires = ["setuptools", "wheel"]
|
|
@@ -30,7 +30,7 @@ setup(name="azure-cli-diff-tool",
|
|
|
30
30
|
author_email='azpycli@microsoft.com',
|
|
31
31
|
packages=find_packages(),
|
|
32
32
|
include_package_data=True,
|
|
33
|
-
install_requires=["deepdiff==6.3.0", "requests"],
|
|
33
|
+
install_requires=["deepdiff==6.3.0", "requests~=2.32.3"],
|
|
34
34
|
package_data={
|
|
35
35
|
"azure_cli_diff_tool": ["data/*"]
|
|
36
36
|
}
|
|
@@ -10,9 +10,10 @@ import os
|
|
|
10
10
|
from azure_cli_diff_tool import meta_diff
|
|
11
11
|
from azure_cli_diff_tool.utils import get_command_tree, extract_cmd_name, extract_cmd_property, extract_para_info, \
|
|
12
12
|
extract_subgroup_name, extract_subgroup_deprecate_property, expand_deprecate_obj, extract_subgroup_property
|
|
13
|
+
TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
class
|
|
16
|
+
class CLIDiffToolTestCase(unittest.TestCase):
|
|
16
17
|
|
|
17
18
|
def test_parse_cmd_tree(self):
|
|
18
19
|
cmd_name = "monitor log-profiles create"
|
|
@@ -65,12 +66,15 @@ class MyTestCase(unittest.TestCase):
|
|
|
65
66
|
self.assertEqual(subgroup_prop, "deprecate_info_hide", "sub group prop extract failed")
|
|
66
67
|
|
|
67
68
|
def test_diff_meta(self):
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
base_meta_file = os.path.join(TEST_DIR, "jsons", "az_monitor_meta_before.json")
|
|
70
|
+
diff_meta_file = os.path.join(TEST_DIR, "jsons", "az_monitor_meta_after.json")
|
|
71
|
+
if not os.path.exists(base_meta_file) or not os.path.exists(diff_meta_file):
|
|
72
|
+
raise ValueError("Meta file not found, please check testing package")
|
|
73
|
+
|
|
74
|
+
result = meta_diff(base_meta_file=base_meta_file,
|
|
75
|
+
diff_meta_file=diff_meta_file,
|
|
73
76
|
output_type="text")
|
|
77
|
+
|
|
74
78
|
target_message = [
|
|
75
79
|
"please confirm cmd `monitor private-link-scope scoped-resource show` removed",
|
|
76
80
|
"sub group `monitor private-link-scope private-endpoint-connection cust` removed",
|
|
@@ -97,11 +101,22 @@ class MyTestCase(unittest.TestCase):
|
|
|
97
101
|
self.assertTrue(ignored, "ignored message found")
|
|
98
102
|
|
|
99
103
|
def test_diff_meta_whitelist(self):
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
base_meta_file = os.path.join(TEST_DIR, "jsons", "az_ams_meta_before.json")
|
|
105
|
+
diff_meta_file = os.path.join(TEST_DIR, "jsons", "az_ams_meta_after.json")
|
|
106
|
+
if not os.path.exists(base_meta_file) or not os.path.exists(diff_meta_file):
|
|
107
|
+
raise ValueError("Meta file not found, please check testing package")
|
|
108
|
+
result = meta_diff(base_meta_file=base_meta_file,
|
|
109
|
+
diff_meta_file=diff_meta_file,
|
|
110
|
+
output_type="text")
|
|
111
|
+
self.assertEqual(result, [], "returned change isn't empty")
|
|
112
|
+
|
|
113
|
+
def test_dynamic_diff_meta_whitelist(self):
|
|
114
|
+
base_meta_file = os.path.join(TEST_DIR, "jsons", "az_mysql_meta_before.json")
|
|
115
|
+
diff_meta_file = os.path.join(TEST_DIR, "jsons", "az_mysql_meta_after.json")
|
|
116
|
+
if not os.path.exists(base_meta_file) or not os.path.exists(diff_meta_file):
|
|
117
|
+
raise ValueError("Meta file not found, please check testing package")
|
|
118
|
+
result = meta_diff(base_meta_file=base_meta_file,
|
|
119
|
+
diff_meta_file=diff_meta_file,
|
|
105
120
|
output_type="text")
|
|
106
121
|
self.assertEqual(result, [], "returned change isn't empty")
|
|
107
122
|
|
|
@@ -149,11 +164,12 @@ class MyTestCase(unittest.TestCase):
|
|
|
149
164
|
self.assertEqual(example_obj["sub_groups"]["acr"]["commands"]["acr helm list"]["parameters"][0]["deprecate_info_redirect"], "resource_group_name2", "deprecate info expand not working properly")
|
|
150
165
|
|
|
151
166
|
def test_diff_meta_for_deprecate_info(self):
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
167
|
+
base_meta_file = os.path.join(TEST_DIR, "jsons", "az_acr_meta_before.json")
|
|
168
|
+
diff_meta_file = os.path.join(TEST_DIR, "jsons", "az_acr_meta_after.json")
|
|
169
|
+
if not os.path.exists(base_meta_file) or not os.path.exists(diff_meta_file):
|
|
170
|
+
raise ValueError("Meta file not found, please check testing package")
|
|
171
|
+
|
|
172
|
+
result = meta_diff(base_meta_file=base_meta_file, diff_meta_file=diff_meta_file, output_type="text")
|
|
157
173
|
target_message = [
|
|
158
174
|
"sub group `acr` added property `deprecate_info_hide` | diff_level: 2",
|
|
159
175
|
"sub group `acr` updated property `deprecate_info_redirect` from `acr2` to `acr3` | diff_level: 1",
|
|
@@ -174,6 +190,23 @@ class MyTestCase(unittest.TestCase):
|
|
|
174
190
|
print(mes)
|
|
175
191
|
self.assertTrue(found, "target message not found")
|
|
176
192
|
|
|
193
|
+
def test_diff_meta_with_different_mod_name(self):
|
|
194
|
+
base_meta_file = os.path.join(TEST_DIR, "jsons", "az_virtual-network-manager_meta_before.json")
|
|
195
|
+
diff_meta_file = os.path.join(TEST_DIR, "jsons", "az_network-manager_meta_after.json")
|
|
196
|
+
if not os.path.exists(base_meta_file) or not os.path.exists(diff_meta_file):
|
|
197
|
+
raise ValueError("Meta file not found, please check testing package")
|
|
198
|
+
result = meta_diff(base_meta_file=base_meta_file, diff_meta_file=diff_meta_file, output_type="text")
|
|
199
|
+
target_message = [
|
|
200
|
+
"updated property `name` from `network_manager_scopes` to `module_name`",
|
|
201
|
+
]
|
|
202
|
+
for mes in target_message:
|
|
203
|
+
found = False
|
|
204
|
+
for line in result:
|
|
205
|
+
if line.find(mes) > -1:
|
|
206
|
+
found = True
|
|
207
|
+
break
|
|
208
|
+
self.assertTrue(found, "target message not found")
|
|
209
|
+
|
|
177
210
|
|
|
178
211
|
if __name__ == '__main__':
|
|
179
212
|
unittest.main()
|
|
File without changes
|
{azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool/data/blob_config.ini
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{azure_cli_diff_tool-0.0.8 → azure_cli_diff_tool-0.1.0}/azure_cli_diff_tool.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|