Goal being to use sosreport pluggin
./sosreport-3.1/sos/plugins/powerpc.py

import os
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin

class PowerPC(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
    """IBM Power System related information
    """

    plugin_name = 'powerpc'

    def check_enabled(self):
        return (self.policy().get_arch() == "ppc64")

    def setup(self):
        try:
            with open('/proc/cpuinfo', 'r') as fp:
                contents = fp.read()
                ispSeries = "pSeries" in contents
                isPowerNV = "PowerNV" in contents
        except:
            ispSeries = False
            isPowerNV = False

        if ispSeries or isPowerNV:
            self.add_copy_spec("/proc/device-tree/")
            self.add_copy_spec("/proc/loadavg")
            self.add_copy_spec("/proc/locks")
            self.add_copy_spec("/proc/misc")
            self.add_copy_spec("/proc/swaps")
            self.add_copy_spec("/proc/version")
            self.add_copy_spec("/dev/nvram")
            self.add_copy_spec("/var/log/platform")
            self.add_cmd_output("ppc64_cpu --smt")
            self.add_cmd_output("ppc64_cpu --cores-present")
            self.add_cmd_output("ppc64_cpu --cores-on")
            self.add_cmd_output("ppc64_cpu --run-mode")
            self.add_cmd_output("ppc64_cpu --frequency")
            self.add_cmd_output("ppc64_cpu --dscr")

        if ispSeries:
            self.add_copy_spec("/proc/ppc64/lparcfg")
            self.add_copy_spec("/proc/ppc64/eeh")
            self.add_copy_spec("/proc/ppc64/systemcfg")
            self.add_cmd_output("lscfg -vp")
            self.add_cmd_output("lsmcode -A")
            self.add_cmd_output("lsvpd --debug")
            self.add_cmd_output("lsvio -des")
            self.add_cmd_output("servicelog --dump")
            self.add_cmd_output("servicelog_notify --list")
            self.add_cmd_output("usysattn")
            self.add_cmd_output("usysident")
            self.add_cmd_output("serv_config -l")
            self.add_cmd_output("bootlist -m both -r")
            self.add_cmd_output("lparstat -i")

        if isPowerNV:
            self.add_copy_spec("/proc/ppc64/")

It sounds like 
self.add_cmd_output() would be replaced with root_command_output()
 self.add_copy_spec()   is reading a path and returning content of files in 
that path, so I would understand that getting the list using read_file() and a 
loop with attach_file() would do the job.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1336462

Title:
  Make apport collect some Power information

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1336462/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to