From 8cdc9c94795753c2d9dc24e76ddea08c773ff1bf Mon Sep 17 00:00:00 2001 From: Brian Elliott Finley Date: Tue, 26 Jan 2021 16:17:56 -0600 Subject: [PATCH 1/2] Add 'list' option to osdeploy command --- confluent_server/bin/osdeploy | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/confluent_server/bin/osdeploy b/confluent_server/bin/osdeploy index 1fbb3d53..cf95b64f 100644 --- a/confluent_server/bin/osdeploy +++ b/confluent_server/bin/osdeploy @@ -1,5 +1,7 @@ #!/usr/bin/python2 +__author__ = 'jjohnson2,bfinley' + import argparse import glob import os @@ -50,7 +52,11 @@ def main(args): 'updateboot', help='Push profile.yaml of the named profile data into boot assets as appropriate') upb.add_argument('profile', help='Profile to update boot assets') + osls = sp.add_parser('list', help='List OS images available for deployment') cmdset = ap.parse_args() + + if cmdset.command == 'list': + return oslist() if cmdset.command == 'import': return osimport(cmdset.imagefile) if cmdset.command == 'initialize': @@ -308,6 +314,27 @@ def updateboot(profilename): print(repr(rsp)) +def oslist(): + c = client.Command() + print "Distributions:" + for rsp in c.read('/deployment/distributions'): + if 'error' in rsp: + sys.stderr.write(res['error'] + '\n') + exitcode = 1 + else: + print(" " + rsp['item']['href'].replace('/', '')) + print "" + + print "Profiles:" + for rsp in c.read('/deployment/profiles'): + if 'error' in rsp: + sys.stderr.write(res['error'] + '\n') + exitcode = 1 + else: + print(" " + rsp['item']['href'].replace('/', '')) + print "" + + def osimport(imagefile): c = client.Command() imagefile = os.path.abspath(imagefile) From 4e2767ce9daed3044a27b95e1140633d002e05f0 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 27 Jan 2021 08:51:03 -0500 Subject: [PATCH 2/2] Update osdeploy --- confluent_server/bin/osdeploy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/confluent_server/bin/osdeploy b/confluent_server/bin/osdeploy index cf95b64f..18a6f9c4 100644 --- a/confluent_server/bin/osdeploy +++ b/confluent_server/bin/osdeploy @@ -316,23 +316,23 @@ def updateboot(profilename): def oslist(): c = client.Command() - print "Distributions:" + print("Distributions:") for rsp in c.read('/deployment/distributions'): if 'error' in rsp: sys.stderr.write(res['error'] + '\n') exitcode = 1 else: print(" " + rsp['item']['href'].replace('/', '')) - print "" + print("") - print "Profiles:" + print("Profiles:") for rsp in c.read('/deployment/profiles'): if 'error' in rsp: sys.stderr.write(res['error'] + '\n') exitcode = 1 else: print(" " + rsp['item']['href'].replace('/', '')) - print "" + print("") def osimport(imagefile):