Skip to content

Commit b024239

Browse files
Merge pull request #138 from guidotijskens/version01243
- LINUX-11094 oci-network-config --add-private-ip error
2 parents 7b9c713 + 7200d3f commit b024239

17 files changed

+1317
-464
lines changed

bin/oci-iscsi-config

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ declare -i post_operation_show=0
2020

2121
# former implementation of oci-iscsi-config was mixing options and sub-commands.
2222
# oci-iscsi-config-main.py now expect proper command line like '<sub-command> <options>'
23-
# translate the command line accordingly (as expected by new implemetation)
23+
# translate the command line accordingly (as expected by new implementation)
2424
# if first token do not start by '-' we consider that command line is following the new format
2525

2626
if [ "${1:0:1}" != '-' ]
@@ -37,7 +37,7 @@ do
3737
-s | --show) if [ -z ${COMMAND} ]
3838
then
3939
COMMAND="show"
40-
cmd_line="${cmd_line} --compat"
40+
cmd_line="${cmd_line} --compat --all"
4141
else
4242
# display information after operation. Used to be an option
4343
# change this to call ourself again with the show command
@@ -80,20 +80,20 @@ then
8080
cmd_line=""
8181
fi
8282

83-
if [ ${IQNS[${COMMAND}]+_} ] && [ -n ${IQNS[${COMMAND}]} ]
83+
if [ ${IQNS[${COMMAND}]+_} ] && [ -n "${IQNS[${COMMAND}]}" ]
8484
then
8585
cmd_line="${cmd_line} --iqns="
86-
for i in "${IQNS[${COMMAND}]}"; do cmd_line="${cmd_line}$i,"; done
86+
for i in ${IQNS[${COMMAND}]}; do cmd_line="${cmd_line}$i,"; done
8787
fi
88-
if [ ${OCIDS[${COMMAND}]+_} ] && [ -n ${OCIDS[${COMMAND}]} ]
88+
if [ ${OCIDS[${COMMAND}]+_} ] && [ -n "${OCIDS[${COMMAND}]}" ]
8989
then
9090
cmd_line="${cmd_line} --ocids="
91-
for i in "${OCIDS[${COMMAND}]}"; do cmd_line="${cmd_line}$i,"; done
91+
for i in ${OCIDS[${COMMAND}]}; do cmd_line="${cmd_line}$i,"; done
9292
fi
93-
if [ ${COMPS[${COMMAND}]+_} ] && [ -n ${COMPS[${COMMAND}]} ]
93+
if [ ${COMPS[${COMMAND}]+_} ] && [ -n "${COMPS[${COMMAND}]}" ]
9494
then
9595
cmd_line="${cmd_line} --compartments="
96-
for i in "${COMPS[${COMMAND}]}"; do cmd_line="${cmd_line}$i,"; done
96+
for i in ${COMPS[${COMMAND}]}; do cmd_line="${cmd_line}$i,"; done
9797
fi
9898

9999
# add assumeyes to old destroy-volume command
@@ -109,11 +109,11 @@ then
109109
fi
110110
if [ $post_operation_show -eq 1 ]
111111
then
112-
${_PY3} ${s_dir}/oci-iscsi-config-main.py $COMMAND ${cmd_line}
112+
${_PY3} ${s_dir}/oci-iscsi-config-main.py $COMMAND ${cmd_line} --compat
113113
if [ $? -eq 0 ]
114114
then
115115
exec ${_PY3} ${s_dir}/oci-iscsi-config-main.py show --compat
116116
fi
117117
else
118-
exec ${_PY3} ${s_dir}/oci-iscsi-config-main.py $COMMAND ${cmd_line}
118+
exec ${_PY3} ${s_dir}/oci-iscsi-config-main.py $COMMAND ${cmd_line} --compat
119119
fi

bin/oci-network-config

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ declare OCID_OR_IP
2828

2929
# former implementation of oci-network-config was mixing options and sub-commands.
3030
# oci-network-config-main.py now expect proper command line like '<sub-command> <options>'
31-
# translate the command line accordingly (as expected by new implemetation)
31+
# translate the command line accordingly (as expected by new implementation)
3232
# if first token does not start by '-' we consider that command line is following the new format
3333

3434
if [ "${1:0:1}" != '-' ]
@@ -54,17 +54,17 @@ do
5454
COMMAND="show --compat-output"
5555
else
5656
# display information after operation. Used to be an option
57-
# change thiso to call ourself again with the show command
57+
# change this to call ourself again with the show command
5858
post_operation_show=1
5959
fi
6060
shift
6161
;;
62-
-a|--auto|-c|--configure) COMMAND="configure" ; shift ;;
63-
-d|--deconfigure) COMMAND="unconfigure" ; shift ;;
64-
--create-vnic) COMMAND="attach-vnic" ; shift ;;
65-
--detach-vnic) COMMAND="detach-vnic" ; OCID_OR_IP=$2 ; shift 2 ;;
66-
--add-private-ip) COMMAND="add-secondary-addr" ; shift ;;
67-
--del-private-ip) COMMAND="remove-secondary-addr" ; cmd_line="${cmd_line} --ip-address=$2" ; shift 2 ;;
62+
-a|--auto|-c|--configure) COMMAND="configure"; post_operation_show=1 ; shift ;;
63+
-d|--deconfigure) COMMAND="unconfigure"; post_operation_show=1 ; shift ;;
64+
--create-vnic) COMMAND="attach-vnic"; post_operation_show=1 ; shift ;;
65+
--detach-vnic) COMMAND="detach-vnic"; OCID_OR_IP=$2 ; post_operation_show=1 ; shift 2 ;;
66+
--add-private-ip) COMMAND="add-secondary-addr"; post_operation_show=1 ; shift ;;
67+
--del-private-ip) COMMAND="remove-secondary-addr" ; cmd_line="${cmd_line} --ip-address=$2"; post_operation_show=1 ; shift 2 ;;
6868
-X|--exclude) if [ -z ${COMMAND} ]
6969
then
7070
COMMAND="show --compat-output";
@@ -132,7 +132,7 @@ then
132132
if [ ${OCID_OR_IP:0:6} == 'ocid1.' ]
133133
then
134134
cmd_line="${cmd_line} --ocid=${OCID_OR_IP}"
135-
else
135+
else
136136
cmd_line="${cmd_line} --ip-address=${OCID_OR_IP}"
137137
fi
138138
fi
@@ -153,25 +153,41 @@ then
153153
then
154154
cmd_line="$cmd_line --ip-address=${PRIVATE_IP}"
155155
fi
156-
else
157-
# if we have found --private-ip and --vnic we gonna add an ip to a vnic
158-
if [ -n "${VNIC_OCID}" ] && [ -n "${PRIVATE_IP}" ]
156+
# else
157+
# obsolete comment # if we have found --private-ip and --vnic we gonne add an ip to a vnic
158+
# if [ -n "${VNIC_OCID}" ] && [ -n "${PRIVATE_IP}" ]
159+
# then
160+
# force command to be
161+
# COMMAND="add-secondary-addr"
162+
# cmd_line="$cmd_line --ip-address=${PRIVATE_IP} --ocid=${VNIC_OCID}"
163+
# fi
164+
elif [ "${COMMAND}" == "add-secondary-addr" ]
165+
then
166+
# --vnic is an option for --add-private-ip only, the requirement for --private-ip is not necessary
167+
# and the --vnic option should only be required if there is more than 1 vnic.
168+
# if --vnic option specified, translate to --ocid optione
169+
if [ -n "${VNIC_OCID}" ]
159170
then
160-
# force command to be
161-
COMMAND="add-secondary-addr"
162-
cmd_line="$cmd_line --ip-address=${PRIVATE_IP} --ocid=${VNIC_OCID}"
171+
cmd_line="$cmd_line --ocid=${VNIC_OCID}"
163172
fi
173+
if [ -n "${PRIVATE_IP}" ]
174+
then
175+
cmd_line="$cmd_line --ip-address=${PRIVATE_IP}"
176+
fi
177+
# else
178+
# echo "_GT_ ${COMMAND} handled elsewhere"
164179
fi
165-
if [ ${EXCLUDED_ITEMS[${COMMAND}]+_} ] && [ -n ${EXCLUDED_ITEMS[${COMMAND}]} ]
180+
181+
if [ ${EXCLUDED_ITEMS[${COMMAND}]+_} ] && [ -n "${EXCLUDED_ITEMS[${COMMAND}]}" ]
166182
then
167-
for i in "${EXCLUDED_ITEMS[${COMMAND}]}"
183+
for i in ${EXCLUDED_ITEMS[${COMMAND}]}
168184
do
169185
cmd_line="${cmd_line} --exclude ${i}"
170186
done
171187
fi
172-
if [ ${INCLUDED_ITEMS[${COMMAND}]+_} ] && [ -n ${INCLUDED_ITEMS[${COMMAND}]} ]
188+
if [ ${INCLUDED_ITEMS[${COMMAND}]+_} ] && [ -n "${INCLUDED_ITEMS[${COMMAND}]}" ]
173189
then
174-
for i in "${INCLUDED_ITEMS[${COMMAND}]}"
190+
for i in ${INCLUDED_ITEMS[${COMMAND}]}
175191
do
176192
cmd_line="${cmd_line} --include ${i}"
177193
done
@@ -180,7 +196,7 @@ fi
180196
if [ $post_operation_show -eq 1 ]
181197
then
182198
${_PY3} ${s_dir}/oci-network-config-main.py $COMMAND ${cmd_line}
183-
# print things as we used to do : incolude systme interface as table , vnic as list etc..
199+
# print things as we used to do : include system interface as table , vnic as list etc..
184200
if [ $? -eq 0 ]
185201
then
186202
exec ${_PY3} ${s_dir}/oci-network-config-main.py show --compat-output

buildrpm/oci-utils.spec

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Name: oci-utils
22
Version: 0.12.4
3-
Release: 2%{?dist}
3+
Release: 4%{?dist}
44
Url: http://cloud.oracle.com/iaas
55
Summary: Oracle Cloud Infrastructure utilities
66
License: UPL
@@ -178,7 +178,21 @@ rm -rf %{buildroot}
178178
/opt/oci-utils/tests/__init__*
179179

180180
%changelog
181-
* Tue Jun 1 2021 Guido Tijskens <guido.tijskens@oracle.com> -- 0.12.4-3
181+
* Thu Jun 17 2021 Guido Tijskens <guido.tijskens@oracle.com> -- 0.12.4-4
182+
- LINUX-11136 compatibility: oci-network-config --(de)configure does not show results
183+
- LINUX-11163 compatibility: oci-network-config differences in output
184+
- LINUX-11164 compatibility: oci-iscsi-config differences in output
185+
- LINUX-11166 oci-iscsi-config show --compartment does not show correct data
186+
- LINUX-11165 oci-iscsi-config unhandled exceptions
187+
- OLUEK-4954 oci-iscsi-config --show does not return values
188+
189+
* Fri Jun 4 2021 Guido Tijskens <guido.tijskens@oracle.com> -- 0.12.4-3
190+
- LINUX-11094 oci-network-config --add-private-ip error
191+
- LINUX-11102 oci-network-config --add-secondary-addr should be able to assign a free IP automatically
192+
- LINUX-11113 oci-network-config show messages when detaching vnic
193+
- LINUX-11114 oci-iscsi-config change messages when no volumes found
194+
195+
* Tue Jun 1 2021 Guido Tijskens <guido.tijskens@oracle.com> -- 0.12.4-2
182196
- LINUX-11099 compatibility issue: oci-iscsi-config --destroy-volume has new prompt to confirm deletion (-y option)
183197
- LINUX-11093 oci-network-config man pages contains incorrect command line format
184198
- LINUX-11085 remove requirement for python3-requests package

lib/oci_utils/impl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def print_choices(header, choices, sep="\n "):
5656

5757
def _oci_utils_exception_hook(exctype, value, tb):
5858
logging.getLogger('oci-utils').critical('An unexpected error occurred: %s', str(value), stack_info=True)
59-
logging.getLogger('oci-utils').debug('An unexpected error occurred', exc_info=value)
59+
logging.getLogger('oci-utils').debug('An unexpected error occurred', exc_info=value, stack_info=True)
6060

6161

6262
sys.excepthook = _oci_utils_exception_hook

0 commit comments

Comments
 (0)