Skip to content
Merged
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
19 changes: 15 additions & 4 deletions src/azure-cli/azure/cli/command_modules/container/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,18 @@ def create_container(cmd,

standby_pool_profile_reference = _create_standby_pool_profile_reference(standby_pool_profile_id=standby_pool_profile_id, fail_container_group_create_on_reuse_failure=fail_container_group_create_on_reuse_failure)

ports = ports or [80]
protocol = protocol or ContainerGroupNetworkProtocol.tcp

# No default values need to be set for the standbypool reuse scenario
if standby_pool_profile_id != None:
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

Use is not None when comparing to None for better readability and to follow PEP8 conventions.

Suggested change
if standby_pool_profile_id != None:
if standby_pool_profile_id is not None:

Copilot uses AI. Check for mistakes.
vnet_address_prefix = None
subnet_address_prefix = None

ports = ports
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

This assignment is redundant and can be removed since it does not change the value of ports.

Suggested change
ports = ports

Copilot uses AI. Check for mistakes.
protocol = protocol
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

This assignment is a no-op and should be removed to simplify the code.

Suggested change
protocol = protocol

Copilot uses AI. Check for mistakes.

if standby_pool_profile_id == None:
Copy link

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

Use is None when checking against None to align with Python best practices.

Suggested change
if standby_pool_profile_id == None:
if standby_pool_profile_id is None:

Copilot uses AI. Check for mistakes.
ports = [80]
protocol = ContainerGroupNetworkProtocol.tcp

config_map = _create_config_map(config_map)

container_resource_requirements = _create_resource_requirements(cpu=cpu, memory=memory)
Expand Down Expand Up @@ -221,7 +230,9 @@ def create_container(cmd,
subnet_id = _get_subnet_id(cmd, location, resource_group_name, vnet, vnet_address_prefix, subnet, subnet_address_prefix)
cgroup_subnet = [ContainerGroupSubnetId(id=subnet_id)]

cgroup_ip_address = _create_ip_address(ip_address, ports, protocol, dns_name_label, subnet_id)
cgroup_ip_address = None
if standby_pool_profile_id == None:
cgroup_ip_address = _create_ip_address(ip_address, ports, protocol, dns_name_label, subnet_id)

# Setup zones, validation done in control plane so check is not needed here
zones = None
Expand Down
Loading