Skip to content
Closed
Changes from all commits
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
11 changes: 6 additions & 5 deletions SoftLayer/CLI/loadbal/service_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
@click.option('--healthcheck-type',
required=True,
help="The health check type")
@click.option('--ip-address', '--ip',
@click.option('--ip',
required=True,
help="The IP of the service")
@environment.pass_env
def cli(env, identifier, enabled, port, weight, healthcheck_type, ip_address):
def cli(env, identifier, enabled, port, weight, healthcheck_type, ip):
"""Adds a new load balancer service."""

mgr = SoftLayer.LoadBalancerManager(env.client)
Expand All @@ -37,10 +37,11 @@ def cli(env, identifier, enabled, port, weight, healthcheck_type, ip_address):

# check if the IP is valid
ip_address_id = None
if ip_address:
if ip:
ip_service = env.client['Network_Subnet_IpAddress']
ip_record = ip_service.getByIpAddress(ip_address)
ip_address_id = ip_record['id']
ip_record = ip_service.getByIpAddress(ip)
if len(ip_record) > 0:
ip_address_id = ip_record['id']

mgr.add_service(loadbal_id,
group_id,
Expand Down