def display_self_help(cls, section): section.set_title('SoS Remote Transport Help') section.add_text( "\nTransports define how SoS connects to nodes and executes " "commands on them for the purposes of an %s run. Generally, " "this means transports define how commands are wrapped locally " "so that they are executed on the remote node(s) instead." % bold('sos collect')) section.add_text( "Transports are generally selected by the cluster profile loaded " "for a given execution, however users may explicitly set one " "using '%s'. Note that not all transports will function for all " "cluster/node types." % bold('--transport=$transport_name')) section.add_text( 'By default, OpenSSH Control Persist is attempted. Additional ' 'information for each supported transport is available in the ' 'following help sections:\n') from sos.collector.sosnode import TRANSPORTS for transport in TRANSPORTS: _sec = bold("collect.transports.%s" % transport) _desc = "The '%s' transport" % transport.lower() section.add_text("{:>8}{:<45}{:<30}".format(' ', _sec, _desc), newline=False)
def display_self_help(self): """Displays the help information for this component directly, that is help for `sos help`. """ self_help = HelpSection( 'Detailed help for sos help', ('The \'help\' sub-command is used to provide more detailed ' 'information on different sub-commands available to sos as well ' 'as different components at play within those sub-commands.') ) self_help.add_text( 'SoS - officially pronounced "ess-oh-ess" - is a diagnostic and ' 'supportability utility used by several Linux distributions as an ' 'easy-to-use tool for standardized data collection. The most known' ' component of which is %s (formerly sosreport) which is used to ' 'collect troubleshooting information into an archive for review ' 'by sysadmins or technical support teams.' % bold('sos report') ) subsect = self_help.add_section('How to search using sos help') usage = bold('$component.$topic.$subtopic') subsect.add_text( 'To get more information on a given topic, use the form \'%s\'.' % usage ) rep_ex = bold('sos help report.plugins.kernel') subsect.add_text("For example '%s' will provide more information on " "the kernel plugin for the report function." % rep_ex) avail_help = self_help.add_section('Available Help Sections') avail_help.add_text( 'The following help sections are available. Additional help' ' topics and subtopics may be displayed within their respective ' 'help section.\n' ) sections = { 'report': 'Detailed help on the report command', 'report.plugins': 'Information on the plugin design of sos', 'report.plugins.$plugin': 'Information on a specific $plugin', 'clean': 'Detailed help on the clean command', 'collect': 'Detailed help on the collect command', 'policies': 'How sos operates on different distributions' } for sect in sections: avail_help.add_text( "\t{:<36}{}".format(bold(sect), sections[sect]), newline=False ) self_help.display()
def display_distro_help(cls, section): if cls.__doc__ and cls.__doc__ is not LinuxPolicy.__doc__: section.add_text(cls.__doc__) else: section.add_text( '\nDetailed help information for this policy is not available') # instantiate the requested policy so we can report more interesting # information like $PATH and loaded presets _pol = cls(None, None, False) section.add_text("Default --upload location: %s" % _pol._upload_url) section.add_text("Default container runtime: %s" % _pol.default_container_runtime, newline=False) section.add_text("$PATH used when running report: %s" % _pol.PATH, newline=False) refsec = section.add_section('Reference URLs') for url in cls.vendor_urls: refsec.add_text("{:>8}{:<30}{:<40}".format(' ', url[0], url[1]), newline=False) presec = section.add_section('Presets Available With This Policy\n') presec.add_text(bold("{:>8}{:<20}{:<45}{:<30}".format( ' ', 'Preset Name', 'Description', 'Enabled Options')), newline=False) for preset in _pol.presets: _preset = _pol.presets[preset] _opts = ' '.join(_preset.opts.to_args()) presec.add_text("{:>8}{:<20}{:<45}{:<30}".format( ' ', preset, _preset.desc, _opts), newline=False)
def display(self): """Print the HelpSection contents, including any subsections, to console. """ print(fill( bold(self.title), width=TERMSIZE, initial_indent=self.indent )) for ln in self.content.splitlines(): print(fill(ln, width=TERMSIZE, initial_indent=self.indent)) for section in self.sections: print('') self.sections[section].display()
def display_help(self, section): section.set_title('SoS Policies') section.add_text( 'Policies help govern how SoS operates on across different distri' 'butions of Linux. They control aspects such as plugin enablement,' ' $PATH determination, how/which package managers are queried, ' 'default upload specifications, and more.') section.add_text( "When SoS intializes most functions, for example %s and %s, one " "of the first operations is to determine the correct policy to " "load for the local system. Policies will determine the proper " "package manager to use, any applicable container runtime(s), and " "init systems so that SoS and report plugins can properly function" " for collections. Generally speaking a single policy will map to" " a single distribution; for example there are separate policies " "for Debian, Ubuntu, RHEL, and Fedora." % (bold('sos report'), bold('sos collect'))) section.add_text( "It is currently not possible for users to directly control which " "policy is loaded.") pols = { 'policies.cos': 'The Google Cloud-Optimized OS distribution', 'policies.debian': 'The Debian distribution', 'policies.redhat': ('Red Hat family distributions, not necessarily' ' including forks'), 'policies.ubuntu': 'Ubuntu/Canonical distributions' } seealso = section.add_section('See Also') seealso.add_text( "For more information on distribution policies, see below\n") for pol in pols: seealso.add_text("{:>8}{:<20}{:<30}".format(' ', pol, pols[pol]), newline=False)
def display_distro_help(cls, section): if cls is not RedHatPolicy: super(RedHatPolicy, cls).display_distro_help(section) return section.add_text( 'This policy is a building block for all other Red Hat family ' 'distributions. You are likely looking for one of the ' 'distributions listed below.\n') subs = { 'centos': CentOsPolicy, 'rhel': RHELPolicy, 'redhatcoreos': RedHatCoreOSPolicy, 'fedora': FedoraPolicy } for subc in subs: subln = bold("policies.%s" % subc) section.add_text("{:>8}{:<35}{:<30}".format( ' ', subln, subs[subc].distro), newline=False)