From bd7d0ba42cd72ce475e3e948e7533e5d00976da7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 7 Aug 2020 14:12:13 -0400 Subject: [PATCH] Add updateboot to osdeploy command --- confluent_client/confluent_env.sh | 5 ++++- confluent_server/bin/osdeploy | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/confluent_client/confluent_env.sh b/confluent_client/confluent_env.sh index 5d9394e4..5989f3db 100644 --- a/confluent_client/confluent_env.sh +++ b/confluent_client/confluent_env.sh @@ -142,7 +142,7 @@ _confluent_osimage_completion() { _confluent_get_args if [ $NUMARGS == 2 ]; then - COMPREPLY=($(compgen -W "initialize import" -- ${COMP_WORDS[COMP_CWORD]})) + COMPREPLY=($(compgen -W "initialize import updateboot" -- ${COMP_WORDS[COMP_CWORD]})) return elif [ ${CMPARGS[1]} == 'initialize' ]; then COMPREPLY=($(compgen -W "-h -u -s -t -i" -- ${COMP_WORDS[COMP_CWORD]})) @@ -150,6 +150,9 @@ _confluent_osimage_completion() compopt -o default COMPREPLY=() return + elif [ ${CMPARGS[1]} == 'updateboot' ]; then + COMPREPLY=($(compgen -W "-n $(confetty show /deployment/profiles|sed -e 's/\///')" -- "${COMP_WORDS[COMP_CWORD]}")) + return fi } diff --git a/confluent_server/bin/osdeploy b/confluent_server/bin/osdeploy index 8312d75b..f90d920c 100644 --- a/confluent_server/bin/osdeploy +++ b/confluent_server/bin/osdeploy @@ -44,11 +44,17 @@ def main(args): wiz.add_argument('-l', help='Set local management node to have SSH certificates and hosts.equiv/.shosts', action='store_true') osip = sp.add_parser('import', help='Import an OS image from an ISO image') osip.add_argument('imagefile', help='File to use for source of importing') + upb = sp.add_parser( + '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') cmdset = ap.parse_args() if cmdset.command == 'import': return osimport(cmdset.imagefile) if cmdset.command == 'initialize': return initialize(cmdset) + if cmdset.command == 'updateboot': + return updateboot(cmdset.profile) ap.print_help() @@ -229,6 +235,16 @@ def initialize(cmdset): # httpd available and enabled? +def updateboot(profilename): + c = client.Command() + for rsp in c.update('/deployment/profiles/{0}'.format(profilename), + {'updateboot': 1}): + if 'updated' in rsp: + print('Updated: {0}'.format(rsp['updated'])) + else: + print(repr(rsp)) + + def osimport(imagefile): c = client.Command() imagefile = os.path.abspath(imagefile)