|
3 | 3 |
|
4 | 4 | import SoftLayer |
5 | 5 | from SoftLayer.CLI import environment |
6 | | -from SoftLayer.CLI import exceptions |
7 | 6 | from SoftLayer.CLI import formatting |
8 | | - |
9 | | - |
10 | | -# pylint: disable=unused-argument |
11 | | -def parse_proto(ctx, param, value): |
12 | | - """Parses the frontend and backend cli options""" |
13 | | - proto = {'protocol': 'HTTP', 'port': 80} |
14 | | - splitout = value.split(':') |
15 | | - if len(splitout) != 2: |
16 | | - raise exceptions.ArgumentError("{}={} is not properly formatted.".format(param, value)) |
17 | | - proto['protocol'] = splitout[0] |
18 | | - proto['port'] = int(splitout[1]) |
19 | | - return proto |
| 7 | +from SoftLayer.CLI.loadbal import protocol_add |
20 | 8 |
|
21 | 9 |
|
22 | 10 | @click.command(cls=SoftLayer.CLI.command.SLCommand, ) |
23 | 11 | @click.argument('identifier') |
24 | 12 | @click.option('--uuid', help="Load Balancer Uuid.") |
25 | | -@click.option('--frontend', '-f', required=True, default='HTTP:80', show_default=True, callback=parse_proto, |
| 13 | +@click.option('--frontend', '-f', required=True, default='HTTP:80', show_default=True, |
| 14 | + callback=protocol_add.parse_proto, |
26 | 15 | help='PROTOCOL:PORT string for incoming internet connections.') |
27 | | -@click.option('--backend', '-b', required=True, default='HTTP:80', show_default=True, callback=parse_proto, |
| 16 | +@click.option('--backend', '-b', required=True, default='HTTP:80', show_default=True, |
| 17 | + callback=protocol_add.parse_proto, |
28 | 18 | help='PROTOCOL:PORT string for connecting to backend servers.') |
29 | 19 | @click.option('--method', '-m', help="Balancing Method.", default='ROUNDROBIN', show_default=True, |
30 | 20 | type=click.Choice(['ROUNDROBIN', 'LEASTCONNECTION', 'WEIGHTED_RR'])) |
|
0 commit comments