diff options
author | jwbernin <jwbernin@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2006-07-22 19:49:23 +0000 |
---|---|---|
committer | jwbernin <jwbernin@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2006-07-22 19:49:23 +0000 |
commit | 358e5ba36c8b17745d96790cb125eb2160817387 (patch) | |
tree | 0fc1c737600909aabd783e337c33eb2ac80af607 /src/example_plugins | |
parent | abfe72dbf66581eee17ef1cab556a4d234166068 (diff) | |
download | sos-358e5ba36c8b17745d96790cb125eb2160817387.tar.gz |
Merging jwb-dev branch to trunk
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@36 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src/example_plugins')
-rwxr-xr-x | src/example_plugins/example.py | 10 | ||||
-rw-r--r-- | src/example_plugins/fsusage.py | 4 | ||||
-rw-r--r-- | src/example_plugins/release.py | 4 | ||||
-rwxr-xr-x | src/example_plugins/runcommand.py | 4 |
4 files changed, 12 insertions, 10 deletions
diff --git a/src/example_plugins/example.py b/src/example_plugins/example.py index 98c40a5d..1e650417 100755 --- a/src/example_plugins/example.py +++ b/src/example_plugins/example.py @@ -38,7 +38,7 @@ class example(sos.plugintools.PluginBase): ('follicles', 'Gathers information about each follicle on every toe', 'slow', 0), ('color', 'Gathers toenail polish color', 'fast', 0)] - def collect(self): + def setup(self): ''' First phase - Collect all the information we need. Directories are copied recursively. arbitrary commands may be executed using the susRunExe method. Information is automatically saved, and @@ -46,16 +46,18 @@ class example(sos.plugintools.PluginBase): copied to the saved tree. Also, links are provided to the output from each command. ''' # Here's how to copy files and directory trees - self.copyFileOrDir("/etc/hosts") + self.addCopySpec("/etc/hosts") # this one saves a file path to the copy for later analysis - self.fooFilePath = self.copyFileOrDir("/proc/cpuinfo") + # FIXME: Need to figure out how to do this + # self.fooFilePath = self.copyFileOrDir("/proc/cpuinfo") # Here's how to test your options and execute if enabled if self.isOptionEnabled("init.d"): - self.copyFileOrDir("/etc/init.d") # copies a whole directory tree + self.addCopySpec("/etc/init.d") # copies a whole directory tree # Here's how to execute a command # you can save the path to the copied file for later analysis if desired + # FIXME: Need to figure out how to do this self.psCmdDstFileName = self.runExe("/bin/ps -ef") return diff --git a/src/example_plugins/fsusage.py b/src/example_plugins/fsusage.py index 898aaa12..2532c5f7 100644 --- a/src/example_plugins/fsusage.py +++ b/src/example_plugins/fsusage.py @@ -18,6 +18,6 @@ import sos.plugintools # Class name must be the same as file name and method names must not change class fsusage(sos.plugintools.PluginBase): - def collect(self): - self.psCmdDstFileName = self.runExe("/bin/df -al") + def setup(self): + self.psCmdDstFileName = self.collectExtOutput("/bin/df -al") return diff --git a/src/example_plugins/release.py b/src/example_plugins/release.py index 5df7ada1..db4d7581 100644 --- a/src/example_plugins/release.py +++ b/src/example_plugins/release.py @@ -16,6 +16,6 @@ import sos.plugintools # Class name must be the same as file name and method names must not change class release(sos.plugintools.PluginBase): - def collect(self): - self.copyFileOrDir("/etc/redhat-release") + def setup(self): + self.addCopySpec("/etc/redhat-release") return diff --git a/src/example_plugins/runcommand.py b/src/example_plugins/runcommand.py index af8cc4fe..df8951d2 100755 --- a/src/example_plugins/runcommand.py +++ b/src/example_plugins/runcommand.py @@ -35,10 +35,10 @@ class runcommand(sos.plugintools.PluginBase): Your finished plugin should be included with your package and installed in python's site-packages/sos/plugins/ directory """ - def collect(self): + def setup(self): ''' Run a command. Output is automatically included in the report. ''' - self.runExe("/path/to/my/script --myoption --anotheroption") + self.collectExtOutput("/path/to/my/script --myoption --anotheroption") # if (for example) that command created files /foo/bar/baz.txt and # we want to include that in our report, we include the next line: |