Server IP : 158.178.228.73 / Your IP : 80.80.80.153 Web Server : Apache/2.4.37 (Oracle Linux Server) OpenSSL/1.1.1k System : Linux ust-wp1-prod 5.15.0-308.179.6.el8uek.x86_64 #2 SMP Wed Apr 23 10:46:57 PDT 2025 x86_64 User : tomasFtp ( 1007) PHP Version : 8.4.8 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/proc/self/root/proc/thread-self/root/bin/ |
Upload File : |
#!/bin/bash # Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved. # Licensed under the Universal Permissive License v 1.0 as shown at # http://oss.oracle.com/licenses/upl. # This utility assists with configuring iscsi storage on Oracle Cloud # Infrastructure instances. See the manual page for more information. _PY3=/usr/bin/python3 _PY_CMD=oci_iscsi_config_main.py s_dir=`${_PY3} -c 'import os.path ; import oci_utils.impl ; print (os.path.dirname(oci_utils.impl.__file__))' 2>/dev/null` declare -A IQNS declare -A OCIDS declare -A COMPS declare COMMAND declare cmd_line="" declare -i post_operation_show=0 # former implementation of oci-iscsi-config was mixing options and sub-commands. # oci-iscsi-config-main.py now expect proper command line like '<sub-command> <options>' # translate the command line accordingly (as expected by new implementation) # if first token do not start by '-' we consider that command line is following the new format if [ "${1:0:1}" != '-' ] then # execute as is as the command line do not start with an option dash-<something> exec ${_PY3} ${s_dir}/${_PY_CMD} "$@" fi PARSED_ARGUMENTS=$(getopt -a --quiet -o sC:iAd:a:c:yf --long show,compartment:,interactive,all,detach:,attach:,create-volume:,destroy-volume:,volume-name:,username:,password:,help,yes,attach-volume,force -- "$@") eval set -- "$PARSED_ARGUMENTS" while : do case "$1" in -s | --show) if [ -z ${COMMAND} ] then COMMAND="show" cmd_line="${cmd_line} --compat --all" else # display information after operation. Used to be an option # change this to call ourself again with the show command post_operation_show=1 fi shift ;; -C | --compartment) COMMAND="show" ; COMPS[${COMMAND}]+="$2," ; shift 2 ;; -i | --interactive) cmd_line="${cmd_line} --interactive" ; shift ;; -A | --all) cmd_line="${cmd_line} --all" ; shift ;; -f | --force) cmd_line="${cmd_line} --force" ; shift ;; -y | --yes) cmd_line="${cmd_line} --yes" ; shift ;; --attach-volume) cmd_line="${cmd_line} --attach-volume" ; shift ;; -d | --detach) COMMAND="detach" ; IQNS[${COMMAND}]+="$2," ; shift 2 ;; -a | --attach) COMMAND="attach" ; IQNS[${COMMAND}]+="$2," ; shift 2 ;; -c | --create-volume) COMMAND="create" ; cmd_line="${cmd_line} --size=$2" ; shift 2 ;; --destroy-volume) COMMAND="destroy" ; OCIDS[${COMMAND}]+="$2,"; ASSUMEYES=True ; shift 2 ;; --volume-name) cmd_line="${cmd_line} --volume-name=$2" ; shift 2 ;; --username) cmd_line="${cmd_line} --username=$2" ; shift 2 ;; --password) cmd_line="${cmd_line} --password=$2" ; shift 2 ;; --help) if [ -z ${COMMAND} ] then COMMAND="usage" else # not displaying the overall usage but command specific one. md_line="${cmd_line} --help" fi break ;; # end of parsing , everything getopt did not understood is after that, we do not care in our case --) if [ -z ${COMMAND} ] then COMMAND="usage" fi shift; break ;; *) COMMAND="usage" ; break ;; esac done if [ -z "${COMMAND}" ] then COMMAND="sync" cmd_line="" fi if [ ${IQNS[${COMMAND}]+_} ] && [ -n "${IQNS[${COMMAND}]}" ] then cmd_line="${cmd_line} --iqns=" for i in ${IQNS[${COMMAND}]}; do cmd_line="${cmd_line}$i,"; done fi if [ ${OCIDS[${COMMAND}]+_} ] && [ -n "${OCIDS[${COMMAND}]}" ] then cmd_line="${cmd_line} --ocids=" for i in ${OCIDS[${COMMAND}]}; do cmd_line="${cmd_line}$i,"; done fi if [ ${COMPS[${COMMAND}]+_} ] && [ -n "${COMPS[${COMMAND}]}" ] then cmd_line="${cmd_line} --compartments=" for i in ${COMPS[${COMMAND}]}; do cmd_line="${cmd_line}$i,"; done fi # add assumeyes to old destroy-volume command if [ ${ASSUMEYES} ] then cmd_line="${cmd_line} --yes" fi # apply defaults to have the same behavior as before if [ ${COMMAND} = "create" ] then cmd_line="${cmd_line} --attach-volume" fi if [ $post_operation_show -eq 1 ] then ${_PY3} ${s_dir}/${_PY_CMD} $COMMAND ${cmd_line} --compat if [ $? -eq 0 ] then exec ${_PY3} ${s_dir}/${_PY_CMD} show --compat fi else exec ${_PY3} ${s_dir}/${_PY_CMD} $COMMAND ${cmd_line} --compat fi