2323from oci_utils .impl .oci_resources import OCIVNIC
2424from oci_utils .impl .row_printer import TablePrinter
2525from oci_utils .impl .row_printer import TextPrinter
26+ from oci_utils .impl .row_printer import get_row_printer_impl
2627from oci_utils .impl .row_printer_helpers import IndentPrinter
2728from oci_utils .impl .row_printer_helpers import get_value_data
2829from oci_utils .impl .row_printer_helpers import initialise_column_lengths
@@ -1001,7 +1002,7 @@ def _display_subnet(interface):
10011002 return nw_conf
10021003
10031004
1004- def show_os_network_config (vnic_utils ):
1005+ def show_os_network_config (vnic_utils , mode ):
10051006 """
10061007 Display the current network interface configuration as well as the VNIC configuration from OCI.
10071008
@@ -1010,6 +1011,9 @@ def show_os_network_config(vnic_utils):
10101011 vnic_utils :
10111012 The VNIC configuration instance.
10121013
1014+ mode :
1015+ The output mode
1016+
10131017 Returns
10141018 -------
10151019 No return value.
@@ -1034,8 +1038,8 @@ def _get_subnet(_, interface):
10341038 ['STATE' , 6 , 'STATE' ],
10351039 ['MAC' , 18 , 'MAC' ],
10361040 ['VNIC ID' , 95 , 'VNIC' ])
1037- printer = TablePrinter ( title = _title , columns = _columns , column_separator = ' ' , text_truncate = False )
1038-
1041+ printerKlass = get_row_printer_impl ( mode )
1042+ printer = printerKlass ( title = _title , columns = _columns , text_truncate = False )
10391043 printer .printHeader ()
10401044 for item in ret :
10411045 printer .printRow (item )
@@ -1062,8 +1066,7 @@ def show_network(show_args):
10621066 network_config = vnic_utils .get_network_config ()
10631067 network_config = update_network_config (network_config )
10641068 #
1065- # for compatibility mode, oci-network-config show should provide the same output as oci-network-config --show;
1066- # if output-mode is specified, compatiblity requirement is dropped.
1069+ # for compatibility mode (when compat-ouptut is set), oci-network-config show should provide the same output as oci-network-config --show;
10671070 showerror = False
10681071 if show_args .compat_output :
10691072 compat_show_vnics_information ()
@@ -1074,8 +1077,8 @@ def show_network(show_args):
10741077 _logger .debug ('Cannot show information' , exc_info = True )
10751078 _logger .error ('Cannot show information: %s' , str (e ))
10761079 showerror = True
1077- if show_args .output_mode == 'table' :
1078- show_os_network_config (vnic_utils )
1080+ if not show_args .compat_output :
1081+ show_os_network_config (vnic_utils , show_args . output_mode )
10791082 return False if showerror else True
10801083
10811084
0 commit comments