PR
スポンサーリンク

[Nutanix]acliコマンドの中身をAIに調べてもらった

スポンサーリンク
Nutanix
Nutanix logo
記事内に広告が含まれています。
スポンサーリンク
スポンサーリンク

はじめに

よく利用するコマンドについてAIのお力を借りて調査してみた備忘録です。

acliコマンド

CVMからそのCVMが動作するホストに対して操作をするためのコマンドです。パスは以下の通りです。

nutanix@NTNX-HOME-A-CVM:192.168.3.112:~$ which acli
/usr/local/nutanix/bin/acli

catで確認

シェルスクリプトでした。

#!/bin/bash
#
# Copyright (c) 2014 Nutanix Inc. All rights reserved.
#
# Author: gasmith@nutanix.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#

base=$(dirname $(readlink -f "$0"))

usage="""usage: $0 [options] [acli command]

Options:
-h This help message.
-H Acropolis websocket server host.
-i Disable inline help for tab completion.
-n Avoid DNS lookups.
-N Disable/enable DNS lookups ('true' - disable DNS, 'false' - enable DNS).
-o Output format ('normal', 'json', 'json-pretty').
-u Acropolis websocket server URL (overrides -H).
-y Replies to all interactive prompts with default values.
"""

host=localhost
url=
assume_default=0
use_dns=0
json=0
pretty=0
inline_help=1

while getopts "ihH:no:N:u:y" opt; do
case "$opt" in
h)
echo -e "$usage"
exit 0
;;
H)
host=$OPTARG
;;
i)
inline_help=0
;;
n)
use_dns=0
;;
N)
case $OPTARG in
true)
use_dns=0
;;
false)
use_dns=1
;;
*)
echo "Ignoring unknown output format: $OPTARG" >&2
;;
esac
;;
o)
case $OPTARG in
normal)
;;
json)
json=1
;;
json-pretty)
json=1
pretty=1
;;
*)
echo "Ignoring unknown output format: $OPTARG" >&2
;;
esac
;;
u)
url=$OPTARG
;;
y)
assume_default=1
;;
*)
echo -e "$usage" 1>&2
exit 1
;;
esac
done
shift $((OPTIND - 1))

if [ -z "$url" ]; then
url="ws://${host}:2030/acli"
fi

flags=("--prompt" "<acropolis> ")
flags+=("--keep_history" "--history_file" "~/.acli_history")
flags+=("--url" "$url")
flags+=("--server_options")
flags+=("{\"use_dns\": ${use_dns}, \"json\": ${json}, \"pretty\": ${pretty}, \"assume_default\": ${assume_default}, \"inline_help\": ${inline_help}}")

exec "${base}/mincli" "${flags[@]}" "$@"

Copilotに聞いてみた

あくまでも参考程度でお願いします。

コメント

タイトルとURLをコピーしました