'daemonMinorVersion': ('Daemon minor version', lambda r: r.DaemonVersion.MinorVersion), 'disks': ('Disks', lambda r: ', '.join(r.Disks)), 'groups': ('Groups', lambda r: ', '.join(r.Groups)), 'hostName': ('Host name', lambda r: r.HostName), 'ipAddress': ('IP address', lambda r: r.IpAddress), 'javaRuntimeName': ('Java runtime name', lambda r: r.JavaVersion.RuntimeName), 'javaRuntimeVersion': ('Java runtime version', lambda r: r.JavaVersion.RuntimeVersion), 'javaSpecificationVersion': ('Java specification version', lambda r: r.JavaVersion.SpecificationVersion), 'javaVersion': ('Java version', lambda r: r.JavaVersion.Version), 'mailRelay': ('Mail relay', lambda r: r.MailRelay), 'platformName': ('Platform name', lambda r: r.Platform.Name), 'platformSuffix': ('Platform suffix', lambda r: r.Platform.Suffix), 'platformVersion': ('Platform version', lambda r: r.Platform.Version), 'project': ('Project', lambda r: r.Project), 'properties': ('Properties', lambda r: ', '.join(r.Properties)), 'uptime': ('Uptime', lambda r: durationms(r.Uptime)), 'v3Identity': ('V3 identity', lambda r: r.V3Identity) } def _do_get_platform_configuration(options): data = dict() for host in options.hosts: r = get_platform_configuration(host, options.auth) for x in options.select: head, lamb = _PLATFORM_CONFIGURATION[x] data[(head, host)] = lamb(r) # Special case if len(options.hosts) == 1 and not options.no_special_output: for k, v in sorted(data.iteritems()): _output_record(options, [k[0], v]) return display = dict([(((k[0],), (k[1],)), v) for k, v in data.iteritems()])
'hostName': ('Host name', lambda r: r.HostName), 'ipAddress': ('IP address', lambda r: r.IpAddress), 'javaRuntimeName': ('Java runtime name', lambda r: r.JavaVersion.RuntimeName), 'javaRuntimeVersion': ('Java runtime version', lambda r: r.JavaVersion.RuntimeVersion), 'javaSpecificationVersion': ('Java specification version', lambda r: r.JavaVersion.SpecificationVersion), 'javaVersion': ('Java version', lambda r: r.JavaVersion.Version), 'mailRelay': ('Mail relay', lambda r: r.MailRelay), 'platformName': ('Platform name', lambda r: r.Platform.Name), 'platformSuffix': ('Platform suffix', lambda r: r.Platform.Suffix), 'platformVersion': ('Platform version', lambda r: r.Platform.Version), 'project': ('Project', lambda r: r.Project), 'properties': ('Properties', lambda r: ', '.join(r.Properties)), 'uptime': ('Uptime', lambda r: durationms(r.Uptime)), 'v3Identity': ('V3 identity', lambda r: r.V3Identity) } def _do_get_platform_configuration(options): data = dict() for host in options.hosts: r = get_platform_configuration(host, options.auth) for x in options.select: head, lamb = _PLATFORM_CONFIGURATION[x] data[(head, host)] = lamb(r) # Special case if len(options.hosts) == 1 and not options.no_special_output: for k, v in sorted(data.iteritems()): _output_record(options, [k[0], v])
'daemonMinorVersion': ('Daemon minor version', lambda r: r.DaemonVersion.MinorVersion), 'disks': ('Disks', lambda r: ', '.join(r.Disks)), 'groups': ('Groups', lambda r: ', '.join(r.Groups)), 'hostName': ('Host name', lambda r: r.HostName), 'ipAddress': ('IP address', lambda r: r.IpAddress), 'javaRuntimeName': ('Java runtime name', lambda r: r.JavaVersion.RuntimeName), 'javaRuntimeVersion': ('Java runtime version', lambda r: r.JavaVersion.RuntimeVersion), 'javaSpecificationVersion': ('Java specification version', lambda r: r.JavaVersion.SpecificationVersion), 'javaVersion': ('Java version', lambda r: r.JavaVersion.Version), 'mailRelay': ('Mail relay', lambda r: r.MailRelay), 'platformName': ('Platform name', lambda r: r.Platform.Name), 'platformSuffix': ('Platform suffix', lambda r: r.Platform.Suffix), 'platformVersion': ('Platform version', lambda r: r.Platform.Version), 'project': ('Project', lambda r: r.Project), 'properties': ('Properties', lambda r: ', '.join(r.Properties)), 'uptime': ('Uptime', lambda r: durationms(r.Uptime)), 'v3Identity': ('V3 identity', lambda r: r.V3Identity) } def _do_get_peer_agreements(options): # Single request to a single host: unthreaded pa = get_peer_agreements(options.hosts[0], options.auth, options.auids[0]) if pa is None: print 'No such AUID' return for pae in pa: for ae in pae.Agreements.Entry: _output_record(options, [pae.PeerId, ae.Key, ae.Value.PercentAgreement, datetimems(ae.Value.PercentAgreementTimestamp), ae.Value.HighestPercentAgreement, datetimems(ae.Value.HighestPercentAgreementTimestamp)]) def _do_get_platform_configuration(options): headlamb = [_PLATFORM_CONFIGURATION[x] for x in options.select]
lambda r: r.get('javaVersion', {}).get('runtimeVersion')), 'javaSpecificationVersion': ('Java specification version', lambda r: r.get('javaVersion', {}).get('specificationVersion')), 'javaVersion': ('Java version', lambda r: r.get('javaVersion', {}).get('version')), 'mailRelay': ('Mail relay', lambda r: r.get('mailRelay')), 'platformName': ('Platform name', lambda r: r.get('platform', {}).get('name')), 'platformSuffix': ('Platform suffix', lambda r: r.get('platform', {}).get('suffix')), 'platformVersion': ('Platform version', lambda r: r.get('platform', {}).get('version')), 'project': ('Project', lambda r: r.get('project')), 'properties': ('Properties', lambda r: ', '.join(r.get('properties'))), 'uptime': ('Uptime', lambda r: durationms(r.get('uptime'))), 'v3Identity': ('V3 identity', lambda r: r.get('v3Identity')) } def _do_get_platform_configuration(options): headlamb = [_PLATFORM_CONFIGURATION[x] for x in options.select] data = dict() for host, result in ThreadPool(options.threads).imap_unordered( \ lambda _host: (_host, get_platform_configuration(_host, options._u, options._p)), \ options.hosts): for head, lamb in headlamb: data[((head, ), (host, ))] = lamb(result) _output_table(options, data, [''], [sorted(options.hosts)])