diff --git a/SoftLayer/CLI/loadbal/service_add.py b/SoftLayer/CLI/loadbal/service_add.py index 5a9fa982a..735aee75a 100644 --- a/SoftLayer/CLI/loadbal/service_add.py +++ b/SoftLayer/CLI/loadbal/service_add.py @@ -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) @@ -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,