def _print_application_show(app, columns=None, output_format=None): if columns: data_dict = dict((k, v) for (k, v) in vars(app).items() if k in columns and not (v is None)) else: data_dict = app.to_dict() utils.print_dict_with_format(data_dict, wrap=72, output_format=output_format)
def _print_ihost_show(ihost, columns=None, output_format=None): optional_fields = [] if columns: fields = columns else: fields = [ 'id', 'uuid', 'personality', 'hostname', 'invprovision', 'administrative', 'operational', 'availability', 'task', 'action', 'mgmt_mac', 'mgmt_ip', 'serialid', 'capabilities', 'bm_type', 'bm_username', 'bm_ip', 'config_applied', 'config_target', 'config_status', 'location', 'uptime', 'reserved', 'created_at', 'updated_at', 'boot_device', 'rootfs_device', 'install_output', 'console', 'tboot', 'vim_progress_status', 'software_load', 'install_state', 'install_state_info', 'inv_state', 'clock_synchronization' ] optional_fields = ['vsc_controllers', 'ttys_dcd'] if ihost.subfunctions != ihost.personality: fields.append('subfunctions') if 'controller' in ihost.subfunctions: fields.append('subfunction_oper') fields.append('subfunction_avail') if ihost.peers: fields.append('peers') # Do not display the trailing '+' which indicates the audit iterations if ihost.install_state_info: ihost.install_state_info = ihost.install_state_info.rstrip('+') if ihost.install_state: ihost.install_state = ihost.install_state.rstrip('+') data_list = [(f, getattr(ihost, f, '')) for f in fields] if optional_fields: data_list += [(f, getattr(ihost, f, '')) for f in optional_fields if hasattr(ihost, f)] data = dict(data_list) utils.print_dict_with_format(data, wrap=72, output_format=output_format)