def testDisplayRegroup(self):
        """test CLI.Display (regroup)"""
        f = makeTestFile("""
# A comment

[Main]
default: local

[local]
map: echo hostfoo
#all:
list: echo all
#reverse:
        """)
        res = GroupResolverConfig(f.name)
        set_std_group_resolver(res)
        try:
            parser = OptionParser("dummy")
            parser.install_display_options(verbose_options=True)
            options, _ = parser.parse_args(["-r"])

            disp = Display(options, color=False)
            self.assertEqual(disp.regroup, True)
            disp.out = StringIO()
            disp.err = StringIO()
            self.assertEqual(disp.line_mode, False)

            ns = NodeSet("hostfoo")

            # nodeset.regroup() is performed by print_gather()
            disp.print_gather(ns, "message0\nmessage1\n")
            self.assertEqual(disp.out.getvalue(),
                "---------------\n@all\n---------------\nmessage0\nmessage1\n\n")
        finally:
            set_std_group_resolver(None)
Beispiel #2
0
    def testDisplayRegroup(self):
        """test CLI.Display (regroup)"""
        f = makeTestFile("""
# A comment

[Main]
default: local

[local]
map: echo hostfoo
#all:
list: echo all
#reverse:
        """)
        res = GroupResolverConfig(f.name)
        set_std_group_resolver(res)
        try:
            parser = OptionParser("dummy")
            parser.install_display_options(verbose_options=True)
            options, _ = parser.parse_args(["-r"])

            disp = Display(options, color=False)
            self.assertEqual(disp.regroup, True)
            disp.out = StringIO()
            disp.err = StringIO()
            self.assertEqual(disp.line_mode, False)

            ns = NodeSet("hostfoo")

            # nodeset.regroup() is performed by print_gather()
            disp.print_gather(ns, "message0\nmessage1\n")
            self.assertEqual(disp.out.getvalue(),
                "---------------\n@all\n---------------\nmessage0\nmessage1\n\n")
        finally:
            set_std_group_resolver(None)
Beispiel #3
0
    def setUp(self):
        # Special tests that require a default group source set
        f = make_temp_file("""
[Main]
default: local

[local]
map: echo example[1-100]
all: echo example[1-1000]
list: echo foo bar moo
        """)
        set_std_group_resolver(GroupResolverConfig(f.name))
    def setUp(self):
        # Special tests that require a default group source set
        f = make_temp_file("""
[Main]
default: local

[local]
map: echo example[1-100]
all: echo example[1-1000]
list: echo foo bar moo
        """)
        set_std_group_resolver(GroupResolverConfig(f.name))
Beispiel #5
0
    def setUp(self):
        # Special tests that require a default group source set
        f = make_temp_file("""
[Main]
default: test

[test]
map: echo example[1-100]
all: echo @foo,@bar,@moo
list: echo foo bar moo

[other]
map: echo nova[030-489]
all: echo @baz,@qux,@norf
list: echo baz qux norf
        """)
        set_std_group_resolver(GroupResolverConfig(f.name))
    def setUp(self):
        # Special tests that require a default group source set
        f = make_temp_file("""
[Main]
default: test

[test]
map: echo example[1-100]
all: echo @foo,@bar,@moo
list: echo foo bar moo

[other]
map: echo nova[030-489]
all: echo @baz,@qux,@norf
list: echo baz qux norf
        """)
        set_std_group_resolver(GroupResolverConfig(f.name))
Beispiel #7
0
 def tearDown(self):
     set_std_group_resolver(None)
 def tearDown(self):
     set_std_group_resolver(None)
Beispiel #9
0
 def tearDown(self):
     set_std_group_resolver(None)
     self.gconff = None
     self.custf = None
Beispiel #10
0
 def tearDown(self):
     set_std_group_resolver(None)
     self.gconff = None
     self.custf = None