summaryrefslogtreecommitdiffstats
path: root/cli/objects/repo.py
diff options
context:
space:
mode:
Diffstat (limited to 'cli/objects/repo.py')
-rw-r--r--cli/objects/repo.py42
1 files changed, 21 insertions, 21 deletions
diff --git a/cli/objects/repo.py b/cli/objects/repo.py
index e77f6fa..7085633 100644
--- a/cli/objects/repo.py
+++ b/cli/objects/repo.py
@@ -19,16 +19,16 @@ class OgRepo():
@staticmethod
def _add_repo(rest, parsed_args):
payload = {
- 'addr': parsed_args.address,
+ 'addr': parsed_args.ip,
'name': parsed_args.name,
}
rest.post('/repository/add', payload=payload)
@staticmethod
def _add_repo_ip(rest, parsed_args):
- for address in parsed_args.address:
- if not check_address(address):
- print(f'Invalid IP address: {address}')
+ for ip in parsed_args.ip:
+ if not check_address(ip):
+ print(f'Invalid IP address: {ip}')
return
r = rest.get('/repositories')
@@ -42,14 +42,14 @@ class OgRepo():
print('Invalid repository id specified')
return
- for address in parsed_args.address:
- if address in target_repo['addr']:
- print(f'The repository already contains the address {address}')
+ for ip in parsed_args.ip:
+ if ip in target_repo['addr']:
+ print(f'The repository already contains the address {ip}')
return
payload = {
'id': parsed_args.id,
- 'addr': target_repo['addr'] + parsed_args.address,
+ 'addr': target_repo['addr'] + parsed_args.ip,
'name': target_repo['name'],
}
rest.post('/repository/update', payload=payload)
@@ -66,7 +66,7 @@ class OgRepo():
group.add_argument('--id',
type=int,
help='repo id (list repos using "ogcli list repos")')
- parser.add_argument('--address',
+ parser.add_argument('--ip',
nargs='+',
required=True,
help='IP list separated by spaces')
@@ -86,7 +86,7 @@ class OgRepo():
nargs='?',
required=True,
help='repo id (list repos using "ogcli list repos")')
- parser.add_argument('--address',
+ parser.add_argument('--ip',
nargs='+',
required=True,
help='IP list separated by spaces')
@@ -97,7 +97,7 @@ class OgRepo():
parsed_args = parser.parse_args(args)
payload = {
'id': parsed_args.id,
- 'addr': parsed_args.address,
+ 'addr': parsed_args.ip,
'name': parsed_args.name,
}
@@ -105,9 +105,9 @@ class OgRepo():
@staticmethod
def _delete_repo_ip(rest, parsed_args):
- for address in parsed_args.address:
- if not check_address(address):
- print(f'Invalid IP address: {address}')
+ for ip in parsed_args.ip:
+ if not check_address(ip):
+ print(f'Invalid IP address: {ip}')
return
r = rest.get('/repositories')
@@ -121,12 +121,12 @@ class OgRepo():
print('Invalid repository id specified')
return
- for address in parsed_args.address:
- if address not in target_repo['addr']:
- print(f'Invalid address {address}: The repository has the following IPs: {target_repo["addr"]}')
+ for ip in parsed_args.ip:
+ if ip not in target_repo['addr']:
+ print(f'Invalid address {ip}: The repository has the following IPs: {target_repo["addr"]}')
return
- target_repo['addr'].remove(address)
+ target_repo['addr'].remove(ip)
payload = {
'id': parsed_args.id,
@@ -149,15 +149,15 @@ class OgRepo():
required=True,
help='repo id (list repos using "ogcli list repos")')
- # --address is optional; if provided, the IP will be removed, otherwise,
+ # --ip is optional; if provided, the IP will be removed, otherwise,
# the repo will be deleted
- parser.add_argument('--address',
+ parser.add_argument('--ip',
nargs='+',
help='IP address to remove from the repository')
parsed_args = parser.parse_args(args)
- if parsed_args.address:
+ if parsed_args.ip:
OgRepo._delete_repo_ip(rest, parsed_args)
else:
OgRepo._delete_repo(rest, parsed_args)