sys.argv.extend

Here are the examples of the python api sys.argv.extend taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

38 Examples 7

Example 1

Project: pymo
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertTrue(isinstance(cmd, test_dist))
        self.assertEqual(cmd.sample_option, "sometext")

Example 2

Project: imagrium
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 3

Project: babble
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assert_(isinstance(cmd, test_dist))
        self.assertEqual(cmd.sample_option, "sometext")

Example 4

Project: NagAconda
Source File: test_operation.py
View license
    def test_ok_status(self):
        """
        Check the exit status for 'ok' readings.

        For Nagios, an 'ok' status is equal to 0.

        """
        self.plugin.enable_status('warning', True)
        sys.argv.extend(['-w', '10'])

        try:
            self.plugin.start()
            self.plugin.set_value('foo', 9)
            self.plugin.finish()
        except SystemExit, e:
            assert e.code == 0
        else:
            assert False

Example 5

Project: NagAconda
Source File: test_operation.py
View license
    def test_warning_status(self):
        """
        Check the exit status for 'warning' readings.

        For Nagios, a 'warning' status is equal to 1.

        """
        self.plugin.enable_status('warning', True)
        sys.argv.extend(['-w', '10'])

        try:
            self.plugin.start()
            self.plugin.set_value('foo', 11)
            self.plugin.finish()
        except SystemExit, e:
            assert e.code == 1
        else:
            assert False

Example 6

Project: NagAconda
Source File: test_options.py
View license
    def test_parameter(self):
        """
        Test that a specified parameter actually reaches our option list.

        """
        self.plugin.add_option("t", "test", "Test required parameter",
            required=True)
        sys.argv.extend(['-t', 'this.is.a.test'])
        self.plugin.start()

        assert self.plugin.options.test == 'this.is.a.test'

Example 7

Project: NagAconda
Source File: test_ranges.py
View license
    def test_simple_threshold(self):
        """
        Test a simple set of thresholds for state change.

        """
        self.plugin.enable_status('warning', True)
        self.plugin.enable_status('critical', True)
        sys.argv.extend(['-w', '10'])
        sys.argv.extend(['-c', '15'])
        self.plugin.start()

        expected = {7: 'ok', 10: 'ok', 12: 'warning',
                    15: 'warning', 17: 'critical'}

        for (t_val, t_status) in expected.items():
            assert self.plugin.set_value('test', t_val) == t_status

Example 8

Project: NagAconda
Source File: test_ranges.py
View license
    def test_inverted_threshold(self):
        """
        Test a couple inverted thresholds for state change.

        """
        self.plugin.enable_status('warning', True)
        self.plugin.enable_status('critical', True)
        sys.argv.extend(['-w', '@5:10'])
        sys.argv.extend(['-c', '@15:20'])
        self.plugin.start()

        expected = {3: 'ok', 5: 'warning', 7: 'warning', 10: 'warning',
                    12: 'ok', 15: 'critical', 17: 'critical',
                    20: 'critical', 22: 'ok'}

        for (t_val, t_status) in expected.items():
            assert self.plugin.set_value('test', t_val) == t_status

Example 9

Project: NagAconda
Source File: test_ranges.py
View license
    def test_range_threshold(self):
        """
        Test a couple range thresholds for state change.

        """
        self.plugin.enable_status('warning', True)
        sys.argv.extend(['-w', '10:15'])
        self.plugin.start()

        expected = {5: 'warning', 10: 'ok', 12: 'ok', 15: 'ok',
                    17: 'warning'}

        for (t_val, t_status) in expected.items():
            assert self.plugin.set_value('test', t_val) == t_status

Example 10

Project: NagAconda
Source File: test_ranges.py
View license
    def test_multiple_ranges(self):
        """
        Test a couple range thresholds for state change.

        """
        self.plugin.enable_status('warning', True)
        sys.argv.extend(['-w', '10,15'])
        self.plugin.start()

        assert self.plugin.set_value('test', 12, threshold=1) == 'warning'
        assert self.plugin.set_value('test', 12, threshold=2) == 'ok'
        assert self.plugin.set_value('test', 16, threshold=2) == 'warning'

Example 11

Project: TrustRouter
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertTrue(isinstance(cmd, test_dist))
        self.assertEqual(cmd.sample_option, "sometext")

Example 12

Project: Veil-Evasion
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 13

Project: acd_cli
Source File: test_actions.py
View license
    @patch('sys.stdout.write')
    def testTree(self, print_):
        files, folders = gen_bunch_of_nodes(50)

        self.cache.insert_nodes(files + folders)
        sys.argv.extend(['tree', '-t'])
        self.assertEqual(run_main(), None)
        self.assertEqual(len(print_.mock_calls), 100)

Example 14

Project: acd_cli
Source File: test_actions.py
View license
    @patch('sys.stdout.write')
    def testList(self, print_):
        db.NodeCache(cache_path)
        folder = gen_folder([])
        files = [gen_file([folder]) for _ in range(50)]

        self.cache.insert_nodes(files + [folder])
        sys.argv.extend(['ls', '-t', '/'])
        self.assertEqual(run_main(), None)
        self.assertEqual(len(print_.mock_calls), 100)

Example 15

Project: chipsec
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertTrue(isinstance(cmd, test_dist))
        self.assertEqual(cmd.sample_option, "sometext")

Example 16

Project: datafari
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 17

Project: crumbs
Source File: test_functional.py
View license
    def populateArgumentVector(self):
        sys.argv.extend([ '--argument-only', 'argument_only' ])
        sys.argv.extend([ '--multi', 'argument_multi' ])

        self.addCleanup(functools.partial(sys.argv.remove, '--argument-only'))
        self.addCleanup(functools.partial(sys.argv.remove, 'argument_only'))
        self.addCleanup(functools.partial(sys.argv.remove, '--multi'))
        self.addCleanup(functools.partial(sys.argv.remove, 'argument_multi'))

        self.p.add_parameter(options = [ '--argument-only', ], only = ( 'argument', ))

Example 18

Project: crumbs
Source File: test_functional.py
View license
    def populateTypes(self):
        sys.argv.extend([ '--type-int', '15' ])

        self.addCleanup(functools.partial(sys.argv.remove, '--type-int'))
        self.addCleanup(functools.partial(sys.argv.remove, '15'))

        self.p.add_parameter(options = [ '--type-int', ], type = int, default = 0)

Example 19

Project: openwrt-mt7620
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 20

Project: openwrt-mt7620
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 21

Project: ironpython3
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 22

Project: kbengine
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 23

Project: kbengine
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 24

Project: iot-utilities
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 25

Project: iot-utilities
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 26

Project: iot-utilities
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 27

Project: iot-utilities
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 28

Project: neuroConstruct
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 29

Project: neuroConstruct
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertIsInstance(cmd, test_dist)
        self.assertEqual(cmd.sample_option, "sometext")

Example 30

Project: medicare-demo
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assert_(isinstance(cmd, test_dist))
        self.assertEqual(cmd.sample_option, "sometext")

Example 31

Project: PyAutoC
Source File: test_dist.py
View license
    def test_command_packages_cmdline(self):
        from distutils.tests.test_dist import test_dist
        sys.argv.extend(["--command-packages",
                         "foo.bar,distutils.tests",
                         "test_dist",
                         "-Ssometext",
                         ])
        d = self.create_distribution()
        # let's actually try to load our test command:
        self.assertEqual(d.get_command_packages(),
                         ["distutils.command", "foo.bar", "distutils.tests"])
        cmd = d.get_command_obj("test_dist")
        self.assertTrue(isinstance(cmd, test_dist))
        self.assertEqual(cmd.sample_option, "sometext")

Example 32

Project: pynag
Source File: test_plugins.py
View license
    def create_params(self, *args):
        sys.argv.extend(args)

Example 33

Project: NagAconda
Source File: test_operation.py
View license
    def test_critical_status(self):
        """
        Check the exit status for 'critical' readings.

        For Nagios, a 'critical' status is equal to 2.

        """
        self.plugin.enable_status('warning', True)
        self.plugin.enable_status('critical', True)
        sys.argv.extend(['-w', '10'])
        sys.argv.extend(['-c', '15'])

        try:
            self.plugin.start()
            self.plugin.set_value('foo', 16)
            self.plugin.finish()
        except SystemExit, e:
            assert e.code == 2
        else:
            assert False

Example 34

Project: acd_cli
Source File: test_actions.py
View license
    def testCheckCacheEmpty(self):
        sys.argv.extend(['ls', '/'])
        self.assertEqual(run_main(), acd_cli.INIT_FAILED_RETVAL)

Example 35

Project: acd_cli
Source File: test_actions.py
View license
    def testCheckCacheNonEmpty(self):
        folder = gen_folder()
        self.cache.insert_nodes([folder])
        sys.argv.extend(['ls', '/'])
        self.assertEqual(run_main(), None)

Example 36

Project: baculafs
Source File: FileSystem.py
View license
def main():

    usage = """
BaculaFS: exposes the Bacula catalog and storage as a Filesystem in USErspace

""" + Fuse.fusage

    bacula_version = _bextract_version()

    # force -o sync_read
    sys.argv.extend(['-o', 'sync_read'])

    server = FileSystem(version=(
                            "BaculaFS version: %s\nbextract version: %s\n"
                            "Python FUSE version: %s" %
                            (__version__, bacula_version, fuse.__version__)),
                        usage=usage)

    server.multithreaded = True

    server.parser.add_option(mountopt="driver",
                             choices=Database.drivers,
                             metavar='|'.join(Database.drivers),
                             default=server.driver,
                             help="database driver [default: %default]")
    server.parser.add_option(mountopt="host",
                             metavar="HOST",
                             default=server.host,
                             help=("database server address "
                                   "[default: %default]"))
    server.parser.add_option(mountopt="port",
                             metavar="PORT",
                             default=server.port,
                             type="int",
                             help="database server port")
    server.parser.add_option(mountopt="database",
                             metavar="PATH",
                             default=server.database,
                             help="database name [default: bacula]")
    server.parser.add_option(mountopt="username",
                             metavar="USERNAME",
                             default=server.username,
                             help="database user name [default: %default]")
    server.parser.add_option(mountopt="password",
                             metavar="PASSWORD",
                             default=server.password,
                             help=("database password (use '-o password= ' "
                                   "to get a password prompt; if not "
                                   "provided, the password is read from the "
                                   "DATABASE_PASSWORD environment variable)"))
    server.parser.add_option(mountopt="conf",
                             metavar="PATH",
                             default=server.conf,
                             help=("storage daemon configuration file "
                                   "[default: %default]"))
    server.parser.add_option(mountopt="client",
                             metavar="CLIENT",
                             default=server.client,
                             help="file daemon name")
    server.parser.add_option(mountopt="fileset",
                             metavar="FILESET",
                             default=server.fileset,
                             help="backup fileset")
    server.parser.add_option(mountopt="device",
                             metavar="DEVICE",
                             default=server.device,
                             help="storage device name [default: %default]")
    server.parser.add_option(mountopt="datetime",
                             metavar="'YYYY-MM-DD hh:mm:ss'",
                             default=server.datetime,
                             help="snapshot date/time [default: now]")
    server.parser.add_option(mountopt="recent_job",
                             action="store_true",
                             default=server.recent_job,
                             help=("select contents of most recent job only "
                                   "[default: %default]"))
    server.parser.add_option(mountopt="joblist",
                             metavar="'JOBID1 JOBID2 ...'",
                             default=server.joblist,
                             help="select contents of specified list of jobs")
    server.parser.add_option(mountopt="cleanup",
                             action="store_true",
                             default=server.cleanup,
                             help=("clean cache directory upon umount "
                                   "[default: %default]"))
    server.parser.add_option(mountopt="move_root",
                             action="store_true",
                             default=server.move_root,
                             help=("make absolute path symlinks point to path "
                                   "under mount point  [default: %default]"))
    server.parser.add_option(mountopt="prefetch_attrs",
                             action="store_true",
                             default=server.prefetch_symlinks,
                             help=("read and parse attributes for all files "
                                   "upon filesystem initialization "
                                   "[default: %default]"))
    server.parser.add_option(mountopt="prefetch_symlinks",
                             action="store_true",
                             default=server.prefetch_symlinks,
                             help=("extract all symbolic links upon "
                                   "filesystem initialization (implies "
                                   "prefetch_attrs) [default: %default]"))
    server.parser.add_option(mountopt="prefetch_regex",
                             metavar="REGEX",
                             default=server.prefetch_regex,
                             help=("extract all objects that match REGEX upon "
                                   "filesystem initialization (implies "
                                   "prefetch_attrs)"))
    server.parser.add_option(mountopt="prefetch_recent",
                             action="store_true",
                             default=server.prefetch_recent,
                             help=("extract contents of most recent non-full "
                                   "job upon filesystem initialization "
                                   "(implies prefetch_symlinks) "
                                   "[default: %default]"))
    server.parser.add_option(mountopt="prefetch_diff",
                             metavar="PATH",
                             default=server.prefetch_diff,
                             help=("extract files that do not match files at "
                                   "PATH (hint: speeds up rsync; "
                                   "implies prefetch_symlinks)"))
    server.parser.add_option(mountopt="prefetch_difflist",
                             metavar="DIFFLIST",
                             default=server.prefetch_difflist,
                             help=("extract files that do not match files in "
                                   "DIFFLIST (list line format: "
                                   "'Day Mon DD hh:mm:ss YYYY PATH'; use '-' "
                                   "to read from standard input; "
                                   "hint: format matches output of "
                                   "'duplicity list-current-files -v0 "
                                   "target_url'; implies prefetch_symlinks)"))
    server.parser.add_option(mountopt="prefetch_list",
                             metavar="LIST",
                             default=server.prefetch_list,
                             help=("extract files that match files in LIST "
                                   "(list should contains one absolute file "
                                   "path per line; use '-' to read from "
                                   "standard input; implies "
                                   "prefetch_symlinks)"))
    server.parser.add_option(mountopt="prefetch_everything",
                             action="store_true",
                             default=server.prefetch_everything,
                             help=("extract everything upon filesystem "
                                   "initialization (complete restore to "
                                   "cache) [default: %default]"))
    server.parser.add_option(mountopt="batch_list",
                             action="store_true",
                             default=server.batch_list,
                             help=("list files to be prefetched and exit "
                                   "[default: %default]"))
    server.parser.add_option(mountopt="batch_bsr",
                             action="store_true",
                             default=server.batch_bsr,
                             help=("dump contnets of bsr file for extracting "
                                   "prefetched files and exit [default: "
                                   "%default]"))
    server.parser.add_option(mountopt="batch_extract",
                             action="store_true",
                             default=server.batch_extract,
                             help=("extract prefetched files to mount point "
                                   "and exit [default: %default]"))
    server.parser.add_option(mountopt="user_cache_path",
                             metavar="PATH",
                             default=server.user_cache_path,
                             help=("user specified cache path (hint: combine "
                                   "this with one of the prefetch options) "
                                   "[default: %default]"))
    server.parser.add_option(mountopt="logging",
                             choices=LOGGING_LEVELS.keys(),
                             metavar='|'.join(LOGGING_LEVELS.keys()),
                             default=server.logging,
                             help="logging level [default: %default]")
    server.parser.add_option(mountopt="syslog",
                             action="store_true",
                             default=server.syslog,
                             help=("log to both syslog and console [default: "
                                   "%default]"))

    server.parse(values=server, errex=1)

    if server.fuse_args.mount_expected():
        if not bacula_version:
            raise RuntimeError('cannot determine Bacula bextract version - '
                               'is it installed?')
        else:
            # we initialize before main (i.e. not in fsinit) so that
            # any failure here aborts the mount
            try:
                server.initialize(bacula_version)
            except:
                server.shutdown()
                raise

    if not server.batch_mode:
        server.main()

    # we shutdown after main, i.e. not in fsshutdown, because
    # calling fsshutdown with multithreaded==True seems to cause
    # the python fuse process to hang waiting for the python gil
    if server.fuse_args.mount_expected():
        server.shutdown()

Example 37

Project: td
Source File: mocks.py
View license
    def addArgs(self, *args):
        sys.argv.extend(args)

Example 38

Project: td
Source File: mocks.py
View license
    def addArgs(self, *args):
        sys.argv.extend(args)