Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AppConfig] Support Import/Export of features in yaml files #11637

Merged
merged 6 commits into from
Jan 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Using yaml.safe_dump and resolving comments
  • Loading branch information
avanigupta committed Jan 2, 2020
commit 1d518d3fbe5db45e10c00541e1777d0cfb025d49
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def __read_kv_from_file(file_path, format_, separator=None, prefix_to_add="", de

elif format_ == 'properties':
config_data = javaproperties.load(config_file)
logger.warning("Importing feature flags from a properties file is not supported. If properties file contains feature flags, they will be imported as regular key-values.")
logger.debug("Importing feature flags from a properties file is not supported. If properties file contains feature flags, they will be imported as regular key-values.")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no need to log here as warning will show up in console. We can add log warning in method for reading features from file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning is targeted for the case when user may have feature flags in properties file, but has also supplied --skip-features argument. In that case, we don't read features from file so we cant add any warning. But since this is an edge case, I can make it logger.debug instead of warning here.


In reply to: 361022792 [](ancestors = 361022792)

except ValueError:
raise CLIError('The input is not a well formatted %s file.' % (format_))
Expand Down Expand Up @@ -195,7 +195,7 @@ def __write_kv_and_features_to_file(file_path, key_values=None, features=None, f
if format_ == 'json':
json.dump(exported_keyvalues, fp, indent=2, ensure_ascii=False)
elif format_ == 'yaml':
yaml.dump(exported_keyvalues, fp, sort_keys=False)
yaml.safe_dump(exported_keyvalues, fp, sort_keys=False)
elif format_ == 'properties':
javaproperties.dump(exported_keyvalues, fp)
except Exception as exception:
Expand Down Expand Up @@ -607,8 +607,7 @@ def __export_keyvalues(fetched_items, format_, separator, prefix=None):

def __export_features(retrieved_features, naming_convention):
feature_reserved_keywords = FeatureManagementReservedKeywords(naming_convention)
exported_dict = {}
exported_dict[feature_reserved_keywords.featuremanagement] = {}
exported_dict = {feature_reserved_keywords.featuremanagement: {}}
client_filters = []

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def export_config(cmd,
skip_features = True
else:
if not naming_convention:
logger.warning("--naming-convention was not provided. Reserved keywords for feature management section will default to PascalCase.")
logger.debug("--naming-convention was not provided. Reserved keywords for feature management section will default to PascalCase.")
naming_convention = 'pascal'
else:
naming_convention = naming_convention.lower()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Fri Dec 20 16:03:20 Pacific Standard Time 2019
#Thu Dec 26 15:10:00 Pacific Standard Time 2019
Color=Red
Region=West US
feature-management.FalseFeature=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interactions:
- -n -g -l
User-Agent:
- python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.77
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.78
accept-language:
- en-US
method: PUT
Expand Down Expand Up @@ -48,7 +48,7 @@ interactions:
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1198'
- '1199'
status:
code: 201
message: Created
Expand All @@ -67,7 +67,7 @@ interactions:
- -n -g -l
User-Agent:
- python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.77
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.78
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AppConfiguration/locations/eastus/operationsStatus/b2f10f41-ad00-6f1f-ca38-83881041cf28?api-version=2019-10-01
response:
Expand Down Expand Up @@ -116,7 +116,7 @@ interactions:
- -n -g -l
User-Agent:
- python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.77
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.78
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.AppConfiguration/configurationStores/CredentialTest000002?api-version=2019-10-01
response:
Expand Down Expand Up @@ -165,7 +165,7 @@ interactions:
- -n -g
User-Agent:
- python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.77
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.78
accept-language:
- en-US
method: GET
Expand Down Expand Up @@ -241,7 +241,7 @@ interactions:
- -n -g
User-Agent:
- python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.77
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.78
accept-language:
- en-US
method: POST
Expand Down Expand Up @@ -275,7 +275,7 @@ interactions:
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1198'
- '1199'
status:
code: 200
message: OK
Expand All @@ -294,7 +294,7 @@ interactions:
- -n -g --id
User-Agent:
- python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.77
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.78
accept-language:
- en-US
method: GET
Expand Down Expand Up @@ -372,7 +372,7 @@ interactions:
- -n -g --id
User-Agent:
- python/3.7.4 (Windows-10-10.0.18362-SP0) msrest/0.6.10 msrest_azure/0.6.2
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.77
azure-mgmt-appconfiguration/0.3.0 Azure-SDK-For-Python AZURECLI/2.0.78
accept-language:
- en-US
method: POST
Expand Down

Large diffs are not rendered by default.

Loading