Skip to content

Commit

Permalink
Merge pull request #274 from kairu-ms/rename-profile-folder
Browse files Browse the repository at this point in the history
Adding 'profile_' prefix for azure stack profile
  • Loading branch information
kairu-ms authored Aug 3, 2023
2 parents 65b97e8 + 26c053b commit b492d48
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/aaz_dev/cli/controller/az_module_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _patch_module(self, mod_name):
def _load_view_profile(self, profile_name, aaz_path):
profile = CLIViewProfile()
profile.name = profile_name
profile_folder_name = profile_name.lower().replace('-', '_')
profile_folder_name = profile.profile_folder_name
profile_path = os.path.join(aaz_path, profile_folder_name)
if not os.path.exists(profile_path):
return profile
Expand Down
1 change: 1 addition & 0 deletions src/aaz_dev/cli/controller/az_operation_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ def _iter_response_scopes_by_schema_base(schema, name, scope_define, cmd_ctx):
key_name = to_snack_case(disc.property)
key_value = disc.value
disc_name = f"disc_{to_snack_case(disc.value)}"

disc_scope_define = f'{scope_define}.discriminate_by("{key_name}", "{key_value}")'
for scopes in _iter_response_scopes_by_schema_base(disc, disc_name, disc_scope_define, cmd_ctx):
yield scopes
Expand Down
2 changes: 1 addition & 1 deletion src/aaz_dev/cli/controller/az_profile_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AzProfileGenerator:
def __init__(self, aaz_folder, profile):
self.aaz_folder = aaz_folder
self.profile = profile
self.profile_folder_name = profile.name.lower().replace('-', '_')
self.profile_folder_name = profile.profile_folder_name
self._removed_folders = set()
self._removed_files = set()
self._modified_files = {}
Expand Down
9 changes: 9 additions & 0 deletions src/aaz_dev/cli/model/atomic/_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ class CLIAtomicProfile(Model):

class Options:
serialize_when_none = False

@property
def profile_folder_name(self):
profile_folder_name = self.name.lower().replace('-', '_')
if profile_folder_name != "latest":
# for rest profiles such as 2019-03-01-hybrid, the folder name starts with digit,
# it's not a valid python package name.
profile_folder_name = "profile_" + profile_folder_name
return profile_folder_name
9 changes: 9 additions & 0 deletions src/aaz_dev/cli/model/view/_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@ class CLIViewProfile(Model):

class Options:
serialize_when_none = False

@property
def profile_folder_name(self):
profile_folder_name = self.name.lower().replace('-', '_')
if profile_folder_name != "latest":
# for rest profiles such as 2019-03-01-hybrid, the folder name starts with digit,
# it's not a valid python package name.
profile_folder_name = "profile_" + profile_folder_name
return profile_folder_name

0 comments on commit b492d48

Please sign in to comment.