[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 16 of 17] Do not hardcode the edition names in the bash completion file, but ask v6d
Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx> # HG changeset patch # User Rob Hoes <rob.hoes@xxxxxxxxxx> # Date 1294419412 0 # Node ID 9e99160603a3f19a762cc5c4e46b6f2ca2b092b3 # Parent ede19e107342daa6cef1ae67ece70a73eacc5c8c Do not hardcode the edition names in the bash completion file, but ask v6d Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx> diff -r ede19e107342 -r 9e99160603a3 ocaml/xapi/cli_frontend.ml --- a/ocaml/xapi/cli_frontend.ml +++ b/ocaml/xapi/cli_frontend.ml @@ -1911,10 +1911,18 @@ { reqd=["edition"]; optn=["host-uuid"; "license-server-address"; "license-server-port"]; - help="Change to another edition, or reactivate the current edition after a license has expired. This may be subject to the successful checkout of an appropriate license"; + help="Change to another edition, or reactivate the current edition after a license has expired. This may be subject to the successful checkout of an appropriate license."; implementation=No_fd Cli_operations.host_apply_edition; flags=[]; }; + "host-all-editions", + { + reqd=[]; + optn=[]; + help="Get a list of all available editions."; + implementation=No_fd Cli_operations.host_all_editions; + flags=[]; + }; "host-evacuate", { reqd=["uuid"]; diff -r ede19e107342 -r 9e99160603a3 ocaml/xapi/cli_operations.ml --- a/ocaml/xapi/cli_operations.ml +++ b/ocaml/xapi/cli_operations.ml @@ -2629,6 +2629,10 @@ raise e | e -> raise e +let host_all_editions printer rpc session_id params = + let editions = List.map (fun (e, _, _, _) -> e) (V6client.get_editions ()) in + printer (Cli_printer.PList editions) + let host_evacuate printer rpc session_id params = let uuid = List.assoc "uuid" params in let host = Client.Host.get_by_uuid rpc session_id uuid in diff -r ede19e107342 -r 9e99160603a3 ocaml/xe-cli/bash-completion --- a/ocaml/xe-cli/bash-completion +++ b/ocaml/xe-cli/bash-completion @@ -52,7 +52,8 @@ case "${COMP_WORDS[1]}" in diagnostic-vm-status) cmd=vm-list;; diagnostic-vdi-status) cmd=vdi-list;; - *) cmd=`echo ${COMP_WORDS[1]} | awk -F- '/^host-cpu-/ || /^host-crashdump-/ { print $1 "-" $2 } $0 !~ /^host-cpu-/ && $0 !~ /^host-crashdump-/ { print $1 }'`-list;; + *) cmd=`echo ${COMP_WORDS[1]} | awk -F- '/^host-cpu-/ || /^host-crashdump-/ { print $1 "-" $2 } +$0 !~ /^host-cpu-/ && $0 !~ /^host-crashdump-/ { print $1 }'`-list;; esac IFS=$'\n,' COMPREPLY=( $(compgen_names "$cmd" uuid "$value") ) @@ -220,11 +221,13 @@ COMPREPLY=( $(compgen -W "vm-power-admin,vm-admin,vm-operator,read-only,pool-operator,pool-admin" -- ${LAST_VALUE}) ) return 0 ;; - edition) # for host-apply-edition (licensing) - IFS=$'\n,' - COMPREPLY=( $(compgen -W "free ,enterprise ,platinum ,enterprise-xd " -- ${value}) ) - return 0 - ;; + edition) # for host-apply-edition (licensing) + IFS=$'\n,' + LAST_VALUE=`echo ${value}|gawk 'BEGIN{FS=" "}{print $NF}'` + EDITIONS=`${xe} host-all-editions --minimal 2>/dev/null` + COMPREPLY=( $(compgen -W "${EDITIONS}" -- ${LAST_VALUE}) ) + return 0 + ;; *) snd=`echo ${param} | cut -d- -f2` fst=`echo ${param} | cut -d- -f1` Attachment:
xen-api.hg-16.patch _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |