Example #1
0
    def test_hack_cmd_grp(self):
        modconf = self.conf.modules.find_by_name('IpTagAppend')

        # look for a objects that use it
        h1 = self.sched.hosts.find_by_name("test_host_0")
        h2 = self.sched.hosts.find_by_name("test_router_0")
        h3 = self.sched.hosts.find_by_name("127.0.0.1")

        #get our modules
        mod = get_instance(modconf)
        # Look if we really change our commands

        # Ok we lie a bit, in the early phase, we should NOT
        # already got poller_tag properties. Must lie here
        # and find a better way to manage this in tests
        h1.hostgroups = 'linux,windows'
        h2.hostgroups = 'linux,windows'
        h3.hostgroups = 'linux,windows'
        
        # Calls the mod with our config
        mod.hook_early_configuration(self)
        

        print "H1", h1.hostgroups
        self.assert_('newgroup' not in h1.hostgroups)

        print "H2", h2.hostgroups
        self.assert_('newgroup' in h2.hostgroups)
        
        print "H3", h3.hostgroups
        self.assert_('newgroup' in h3.hostgroups)
Example #2
0
    def test_hack_cmd_grp(self):
        modconf = self.conf.modules.find_by_name('IpTagAppend')

        # look for a objects that use it
        h1 = self.sched.hosts.find_by_name("test_host_0")
        h2 = self.sched.hosts.find_by_name("test_router_0")
        h3 = self.sched.hosts.find_by_name("127.0.0.1")

        # get our modules
        mod = get_instance(modconf)
        # Look if we really change our commands

        # Ok we lie a bit, in the early phase, we should NOT
        # already got poller_tag properties. Must lie here
        # and find a better way to manage this in tests
        h1.hostgroups = 'linux,windows'
        h2.hostgroups = 'linux,windows'
        h3.hostgroups = 'linux,windows'

        # Calls the mod with our config
        mod.hook_early_configuration(self)

        print "H1", h1.hostgroups
        self.assert_('newgroup' not in h1.hostgroups)

        print "H2", h2.hostgroups
        self.assert_('newgroup' in h2.hostgroups)

        print "H3", h3.hostgroups
        self.assert_('newgroup' in h3.hostgroups)
Example #3
0
    def test_hack_cmd_poller_tag(self):
        modconf = self.conf.modules.find_by_name('IpTag')

        # look for a objects that use it
        h1 = self.sched.hosts.find_by_name("test_host_0")
        h2 = self.sched.hosts.find_by_name("test_router_0")

        #get our modules
        mod = get_instance(modconf)
        # Look if we really change our commands

        # Ok we lie a bit, in the early phase, we should NOT
        # already got poller_tag properties. Must lie here
        # and find a better way to manage this in tests
        del h2.poller_tag
        
        # Calls the mod with our config
        mod.hook_early_configuration(self)
        

        print "H1", h1.poller_tag
        self.assert_(h1.poller_tag == 'None')

        print"H2", h2.poller_tag
        self.assert_(h2.poller_tag == 'DMZ')
Example #4
0
    def test_hack_cmd_poller_tag(self):
        modconf = self.conf.modules.find_by_name('IpTag')

        # look for a objects that use it
        h1 = self.sched.hosts.find_by_name("test_host_0")
        h2 = self.sched.hosts.find_by_name("test_router_0")

        # get our modules
        mod = get_instance(modconf)
        # Look if we really change our commands

        # Ok we lie a bit, in the early phase, we should NOT
        # already got poller_tag properties. Must lie here
        # and find a better way to manage this in tests
        del h2.poller_tag

        # Calls the mod with our config
        mod.hook_early_configuration(self)

        print "H1", h1.poller_tag
        self.assert_(h1.poller_tag == 'None')

        print "H2", h2.poller_tag
        self.assert_(h2.poller_tag == 'DMZ')