Skip to content

Commit 27fe4f3

Browse files
author
guido tijskens
committed
oci-utils 0.12.6-12c
1 parent 22cf455 commit 27fe4f3

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

lib/oci_utils/impl/oci-iscsi-config-main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ def display_attached_volumes(oci_sess, iscsiadm_session, disks, output_mode, det
761761
print("List info from Cloud instead(No boot volume).")
762762
print("")
763763
_display_oci_volume_list(oci_vols, output_mode, details, truncate)
764+
return
764765

765766
_cols = ['Target',
766767
'Volume Name',
@@ -846,6 +847,7 @@ def display_attached_volumes(oci_sess, iscsiadm_session, disks, output_mode, det
846847
iscsi_dev_printer.rowBreak()
847848
iscsi_dev_printer.printFooter()
848849
iscsi_dev_printer.finish()
850+
return
849851

850852

851853
# def display_detached_iscsi_device(iqn, targets, attach_failed=()):

tests/test_cli_network_config_attach.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ def test_attach_detach_vnic(self):
142142
time.sleep(self.waittime)
143143
vn_ocid = self._get_vnic_ocid(self.vnic_name)
144144
new_ipv4 = _get_ip_from_response(create_data)[0]
145-
self.assertEqual(subprocess.check_output([self.oci_net_config, 'detach-vnic', '--ocid', vn_ocid]).decode('utf-8'), '')
145+
detach_data = subprocess.check_output([self.oci_net_config, 'detach-vnic', '--ocid', vn_ocid]).decode('utf-8')
146+
self.assertIn('is detached', detach_data, '')
146147
time.sleep(self.waittime)
147148
except Exception as e:
148149
self.fail('Execution oci-network-config attach detach has failed: %s' % str(e))
@@ -160,14 +161,17 @@ def test_add_remove_secondary_ip_0(self):
160161
self.assertIn('Creating', subprocess.check_output([self.oci_net_config, 'attach-vnic', '--name', self.vnic_name]).decode('utf-8'), 'attach vnic failed')
161162
time.sleep(self.waittime)
162163
vn_ocid = self._get_vnic_ocid(self.vnic_name)
163-
response = subprocess.check_output([self.oci_net_config, 'add-secondary-addr, --ocid', vn_ocid]).decode('utf-8'),
164-
self.assertIn('Provisioning secondary private IP', response, 'adding secondary ip failed')
165-
new_ip = _get_ip_from_response(response)[0]
164+
response = subprocess.check_output([self.oci_net_config, 'add-secondary-addr','--ocid', vn_ocid]).decode('utf-8').splitlines()
165+
self.assertIn('Provisioning secondary private', response[0], 'adding secondary ip failed')
166+
new_ip = _get_ip_from_response(response[0])
166167
time.sleep(self.waittime)
167-
self.assertIn('Deconfigure secondary private IP', subprocess.check_output([self.oci_net_config, 'remove-secondary-addr', '--ip-address', new_ip]).decode('utf-8'), 'remove secondary ip failed')
168+
response = subprocess.check_output([self.oci_net_config, 'remove-secondary-addr', '--ip-address', new_ip]).decode('utf-8').splitlines()
169+
self.assertIn('Deconfigure secondary private', response[0], 'remove secondary ip failed')
168170
time.sleep(self.waittime)
169-
self.assertEqual(subprocess.check_output([self.oci_net_config, 'detach-vnic', '--ocid', vn_ocid]).decode('utf-8'), '')
171+
detach_data = subprocess.check_output([self.oci_net_config, 'detach-vnic', '--ocid', vn_ocid]).decode('utf-8')
172+
self.assertIn('is detached', detach_data, '')
170173
time.sleep(self.waittime)
174+
171175
except Exception as e:
172176
self.fail('Execution oci-network-config attach detach has failed: %s' % str(e))
173177

0 commit comments

Comments
 (0)