Skip to content

Commit ec35fe1

Browse files
committed
fix(acns): npe issue for acns transit encryption flag
Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
1 parent a6de7cc commit ec35fe1

File tree

6 files changed

+2699
-15
lines changed

6 files changed

+2699
-15
lines changed

src/aks-preview/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ Pending
1414
* Add `--node-provisioning-default-pools` to the `az aks update` command.
1515
* Add `--node-provisioning-default-pools` to the `az aks create` command.
1616

17+
18.0.0b14
18+
+++++++
19+
* Fixed NPE issue for `--acns-transit-encryption-type`.
20+
1721
18.0.0b13
1822
+++++++
1923
* Add option `--enable-http-proxy` to `az aks update`.

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)