From 569b0107c1d81f9a632e9f8c461b1911c0a15742 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Mon, 5 Feb 2024 13:27:31 +0100 Subject: ogcli: validate integer type in every --id argument missing validation of --id, user needs to supply an integer --- cli/objects/center.py | 1 + cli/objects/images.py | 1 + cli/objects/repo.py | 2 ++ cli/objects/server.py | 2 ++ 4 files changed, 6 insertions(+) (limited to 'cli') diff --git a/cli/objects/center.py b/cli/objects/center.py index 27917ff..0318a57 100644 --- a/cli/objects/center.py +++ b/cli/objects/center.py @@ -29,6 +29,7 @@ class OgCenter(): def delete_center(rest, args): parser = argparse.ArgumentParser(prog='ogcli delete center') parser.add_argument('--id', + type=int, nargs='?', required=True, help='center id in database') diff --git a/cli/objects/images.py b/cli/objects/images.py index 6a20cfb..5f4a146 100644 --- a/cli/objects/images.py +++ b/cli/objects/images.py @@ -161,6 +161,7 @@ class OgImage(): required=True, help='Partition') parser.add_argument('--id', + type=int, nargs='?', required=True, help='Image id') diff --git a/cli/objects/repo.py b/cli/objects/repo.py index c586768..c287926 100644 --- a/cli/objects/repo.py +++ b/cli/objects/repo.py @@ -45,6 +45,7 @@ class OgRepo(): def delete_repo(rest, args): parser = argparse.ArgumentParser(prog='ogcli delete repo') parser.add_argument('--id', + type=int, nargs='?', required=True, help='repo id (list repos using "ogcli list repos")') @@ -56,6 +57,7 @@ class OgRepo(): def set_repo(rest, args): parser = argparse.ArgumentParser(prog='ogcli set repo') parser.add_argument('--id', + type=int, nargs='?', required=True, help='repo id (list repos using "ogcli list repos")') diff --git a/cli/objects/server.py b/cli/objects/server.py index 25b545a..38cc6b0 100644 --- a/cli/objects/server.py +++ b/cli/objects/server.py @@ -31,6 +31,7 @@ class OgServer(): def delete_server(rest, args): parser = argparse.ArgumentParser(prog='ogcli delete server') parser.add_argument('--id', + type=int, nargs='?', required=True, help='server id in the database') @@ -42,6 +43,7 @@ class OgServer(): def set_server(rest, args): parser = argparse.ArgumentParser(prog='ogcli set server') parser.add_argument('--id', + type=int, nargs='?', required=True, help='server id in the database') -- cgit v1.2.3-18-g5258