예제 #1
0
파일: plugin_tests.py 프로젝트: xhe123/sos
 def test_get_unset_plugin_option_with_default(self):
     # this shows that even when we pass in a default to get,
     # we'll get the option's default as set in the plugin
     # this might not be what we really want
     p = MockPlugin({'sysroot': self.sysroot, 'policy': LinuxPolicy(init=InitSystem()),
                     'cmdlineopts': MockOptions()})
     self.assertEquals(p.get_option("opt", True), True)
예제 #2
0
파일: plugin_tests.py 프로젝트: xhe123/sos
 def setUp(self):
     self.mp = MockPlugin({
         'cmdlineopts': MockOptions(),
         'policy': LinuxPolicy(init=InitSystem()),
         'sysroot': os.getcwd()
     })
     self.mp.archive = MockArchive()
예제 #3
0
 def test_get_option_as_list_plugin_option_default(self):
     p = MockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem()),
         'cmdlineopts': MockOptions()
     })
     self.assertEquals(p.get_option_as_list("opt", default=[]), [])
예제 #4
0
 def test_get_unset_plugin_option(self):
     p = MockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem()),
         'cmdlineopts': MockOptions()
     })
     self.assertEquals(p.get_option("opt"), 0)
예제 #5
0
 def test_set_nonexistant_plugin_option(self):
     p = MockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem()),
         'cmdlineopts': MockOptions()
     })
     self.assertFalse(p.set_option("badopt", "testing"))
예제 #6
0
 def test_plugin_no_descrip(self):
     p = MockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem()),
         'cmdlineopts': MockOptions()
     })
     self.assertEquals(p.get_description(), "<no description available>")
예제 #7
0
 def test_plugin_set_name(self):
     p = NamedMockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem()),
         'cmdlineopts': MockOptions()
     })
     self.assertEquals(p.name(), "testing")
예제 #8
0
 def test_get_option_as_list_plugin_option_not_list(self):
     p = MockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem()),
         'cmdlineopts': MockOptions()
     })
     p.set_option("opt", "testing")
     self.assertEquals(p.get_option_as_list("opt"), ['testing'])
예제 #9
0
 def test_get_option_as_list_plugin_option(self):
     p = MockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem()),
         'cmdlineopts': MockOptions()
     })
     p.set_option("opt", "one,two,three")
     self.assertEquals(p.get_option_as_list("opt"), ['one', 'two', 'three'])
예제 #10
0
 def setUp(self):
     self.mp = MockPlugin({
         'cmdlineopts': MockOptions(),
         'policy': LinuxPolicy(init=InitSystem(), probe_runtime=False),
         'sysroot': os.getcwd(),
         'devices': {}
     })
     self.mp.archive = MockArchive()
예제 #11
0
파일: plugin_tests.py 프로젝트: xhe123/sos
 def test_postproc_default_on(self):
     p = PostprocMockPlugin({
         'cmdlineopts': MockOptions(),
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem())
     })
     p.postproc()
     self.assertTrue(p.did_postproc)
예제 #12
0
 def test_get_unset_plugin_option(self):
     p = MockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem(), probe_runtime=False),
         'cmdlineopts': MockOptions(),
         'devices': {}
     })
     self.assertEquals(p.get_option("opt"), 0)
예제 #13
0
 def test_plugin_default_name(self):
     p = MockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem(), probe_runtime=False),
         'cmdlineopts': MockOptions(),
         'devices': {}
     })
     self.assertEquals(p.name(), "mockplugin")
예제 #14
0
파일: plugin_tests.py 프로젝트: tryfan/sos
 def test_plugin_no_descrip(self):
     p = NamedMockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem(), probe_runtime=False),
         'cmdlineopts': MockOptions(),
         'devices': {}
     })
     self.assertEquals(p.get_description(), "This plugin has a description.")
예제 #15
0
파일: plugin_tests.py 프로젝트: xhe123/sos
 def test_copy_dir_forbidden_path(self):
     p = ForbiddenMockPlugin({
         'cmdlineopts': MockOptions(),
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem())
     })
     p.archive = MockArchive()
     p.setup()
     p.collect()
     self.assertEquals(p.archive.m, {})
예제 #16
0
 def test_get_unset_plugin_option_with_default_not_none(self):
     # this shows that even when we pass in a default to get,
     # if the plugin default is not None
     # we'll get the option's default as set in the plugin
     # this might not be what we really want
     p = MockPlugin({
         'sysroot': self.sysroot,
         'policy': LinuxPolicy(init=InitSystem(), probe_runtime=False),
         'cmdlineopts': MockOptions(),
         'devices': {}
     })
     self.assertEquals(p.get_option("opt2", True), False)
예제 #17
0
파일: option_tests.py 프로젝트: wbclark/sos
 def setUp(self):
     self.commons = {
         'sysroot': '/',
         'policy': LinuxPolicy(init=InitSystem()),
         'cmdlineopts': MockOptions()
     }
     self.plugin = Plugin(self.commons)
     self.plugin.opt_names = ['baz', 'empty', 'test_option']
     self.plugin.opt_parms = [{
         'enabled': False
     }, {
         'enabled': None
     }, {
         'enabled': 'foobar'
     }]
예제 #18
0
파일: sosnode.py 프로젝트: sscargal/sos
 def determine_host_policy(self):
     """Attempts to identify the host installation against supported
     distributions
     """
     if self.local:
         self.log_info("using local policy %s"
                       % self.commons['policy'].distro)
         return self.commons['policy']
     host = load(cache={}, sysroot=self.opts.sysroot, init=InitSystem(),
                 probe_runtime=False, remote_exec=self.ssh_cmd,
                 remote_check=self.read_file('/etc/os-release'))
     if host:
         self.log_info("loaded policy %s for host" % host.distro)
         return host
     self.log_error('Unable to determine host installation. Ignoring node')
     raise UnsupportedHostException