From aeb1b704b388ba8b0434e2ee0d851ce5c26a90f1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 16 Mar 2021 11:18:46 -0400 Subject: [PATCH] Add mechanism to supply data from argv Some POST calls may want body from CLI, make this easier by no longer requiring a file to do so. --- confluent_osdeploy/common/opt/confluent/bin/apiclient | 2 ++ 1 file changed, 2 insertions(+) diff --git a/confluent_osdeploy/common/opt/confluent/bin/apiclient b/confluent_osdeploy/common/opt/confluent/bin/apiclient index 9abfd5ea..af66b7aa 100644 --- a/confluent_osdeploy/common/opt/confluent/bin/apiclient +++ b/confluent_osdeploy/common/opt/confluent/bin/apiclient @@ -130,6 +130,8 @@ if __name__ == '__main__': outf.write(chunk) chunk = reader.read(16384) sys.exit(0) + elif len(sys.argv) > 2 and not os.path.exists(sys.argv[-1]): + data = sys.argv[-1] if os.path.exists(sys.argv[-1]): data = open(sys.argv[-1]).read() sys.stdout.write(HTTPSClient(json=json).grab_url(sys.argv[1], data).decode())