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.py41
1 files changed, 36 insertions, 5 deletions
diff --git a/cli/objects/repo.py b/cli/objects/repo.py
index a85f7a3..4e20edd 100644
--- a/cli/objects/repo.py
+++ b/cli/objects/repo.py
@@ -20,28 +20,59 @@ class OgRepo():
def add_repo(rest, args):
parser = argparse.ArgumentParser(prog='ogcli add repo')
parser.add_argument('--address',
- nargs='?',
+ nargs='+',
required=True,
- help='valid ip address')
+ help='IP list separated by spaces')
parser.add_argument('--name',
nargs='?',
required=True,
- help='valid ip address')
+ help='name of the repository')
parser.add_argument('--center',
nargs='?',
type=int,
help='(Optional, Legacy) Center id serving this repository')
parsed_args = parser.parse_args(args)
payload = {
- 'ip': parsed_args.address,
+ 'addr': parsed_args.address,
'name': parsed_args.name,
}
if parsed_args.center:
- payload['center']: center
+ payload['center']: parsed_args.center
rest.post('/repository/add', payload=payload)
@staticmethod
+ def update_repo(rest, args):
+ parser = argparse.ArgumentParser(prog='ogcli add repo')
+ parser.add_argument('--id',
+ type=int,
+ nargs='?',
+ required=True,
+ help='repo id (list repos using "ogcli list repos")')
+ parser.add_argument('--address',
+ nargs='+',
+ required=True,
+ help='IP list separated by spaces')
+ parser.add_argument('--name',
+ nargs='?',
+ required=True,
+ help='name of the repository')
+ parser.add_argument('--center',
+ nargs='?',
+ type=int,
+ help='(Optional, Legacy) Center id serving this repository')
+ parsed_args = parser.parse_args(args)
+ payload = {
+ 'id': parsed_args.id,
+ 'addr': parsed_args.address,
+ 'name': parsed_args.name,
+ }
+ if parsed_args.center:
+ payload['center']: parsed_args.center
+
+ rest.post('/repository/update', payload=payload)
+
+ @staticmethod
def delete_repo(rest, args):
parser = argparse.ArgumentParser(prog='ogcli delete repo')
parser.add_argument('--id',