Skip to content

Commit 0ddaeb4

Browse files
committed
fix(acns): npe issue for acns transit encryption flag
Signed-off-by: Quang Nguyen <[email protected]>
1 parent a6de7cc commit 0ddaeb4

File tree

6 files changed

+2703
-15
lines changed

6 files changed

+2703
-15
lines changed

src/aks-preview/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ To release a new version, please select a new version number (usually plus 1 to
1111

1212
Pending
1313
+++++++
14+
15+
18.0.0b14
16+
+++++++
17+
* Fixed NPE issue for `--acns-transit-encryption-type`.
1418
* Add `--node-provisioning-default-pools` to the `az aks update` command.
1519
* Add `--node-provisioning-default-pools` to the `az aks create` command.
1620

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,13 +3027,10 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
30273027
acns.security.advanced_network_policies = acns_advanced_networkpolicies
30283028
if acns_transit_encryption_type is not None:
30293029
if acns.security is None:
3030-
acns.security = self.models.AdvancedNetworkingSecurity(
3031-
transit_encryption=self.models.AdvancedNetworkingSecurityTransitEncryption(
3032-
type=acns_transit_encryption_type
3033-
)
3034-
)
3035-
else:
3036-
acns.security.transit_encryption.type = acns_transit_encryption_type
3030+
acns.security = self.models.AdvancedNetworkingSecurity()
3031+
if acns.security.transit_encryption is None:
3032+
acns.security.transit_encryption = self.models.AdvancedNetworkingSecurityTransitEncryption()
3033+
acns.security.transit_encryption.type = acns_transit_encryption_type
30373034
network_profile.advanced_networking = acns
30383035
return mc
30393036

@@ -4142,13 +4139,10 @@ def update_acns_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
41424139
acns.security.advanced_network_policies = acns_advanced_networkpolicies
41434140
if acns_transit_encryption_type is not None:
41444141
if acns.security is None:
4145-
acns.security = self.models.AdvancedNetworkingSecurity(
4146-
transit_encryption=self.models.AdvancedNetworkingSecurityTransitEncryption(
4147-
type=acns_transit_encryption_type
4148-
)
4149-
)
4150-
else:
4151-
acns.security.transit_encryption.type = acns_transit_encryption_type
4142+
acns.security = self.models.AdvancedNetworkingSecurity()
4143+
if acns.security.transit_encryption is None:
4144+
acns.security.transit_encryption = self.models.AdvancedNetworkingSecurityTransitEncryption()
4145+
acns.security.transit_encryption.type = acns_transit_encryption_type
41524146
mc.network_profile.advanced_networking = acns
41534147
return mc
41544148

0 commit comments

Comments
 (0)