Skip to content

Commit e1a34cc

Browse files
[App Config] az appconfig kv import\export: Fix bug when importing feature flag with percentile allocation property (#30732)
1 parent 1ee9981 commit e1a34cc

25 files changed

+63383
-50896
lines changed

src/azure-cli/azure/cli/command_modules/appconfig/_featuremodels.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,15 @@ class FeaturePercentileAllocation:
366366
367367
:ivar str variant:
368368
The name of the variant to use if the calculated percentile for the current user falls in the provided range.
369-
:ivar number from_:
369+
:ivar number from:
370370
The lower end of the percentage range for which this variant will be used.
371371
:ivar number to:
372372
The upper end of the percentage range for which this variant will be used.
373373
"""
374374

375375
def __init__(self, variant, from_, to):
376376
self.variant = variant
377-
self.from_ = from_
377+
setattr(self, "from", from_)
378378
self.to = to
379379

380380
@classmethod
@@ -435,7 +435,7 @@ def convert_from_dict(cls, percentile_allocation_dict):
435435
def __repr__(self):
436436
feature_percentile_allocation = {
437437
FeatureFlagConstants.VARIANT: self.variant,
438-
FeatureFlagConstants.FROM: self.from_,
438+
FeatureFlagConstants.FROM: getattr(self, "from"),
439439
FeatureFlagConstants.TO: self.to,
440440
}
441441

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/import_features_new_fm_schema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
"client_filters": []
99
},
1010
"allocation": {
11+
"percentile": [
12+
{
13+
"variant": "Off",
14+
"to": 100,
15+
"from": 0
16+
}
17+
],
1118
"user": [
1219
{
1320
"variant": "Alpha",

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_appconfig_to_appconfig_import_export.yaml

Lines changed: 1495 additions & 1410 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_aad_auth.yaml

Lines changed: 1159 additions & 820 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_credential.yaml

Lines changed: 690 additions & 584 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_feature.yaml

Lines changed: 7299 additions & 5991 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_feature_filter.yaml

Lines changed: 6460 additions & 5167 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_feature_namespacing.yaml

Lines changed: 1121 additions & 933 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_identity.yaml

Lines changed: 190 additions & 140 deletions
Large diffs are not rendered by default.

src/azure-cli/azure/cli/command_modules/appconfig/tests/latest/recordings/test_azconfig_import_export.yaml

Lines changed: 12148 additions & 9402 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)