Ejemplo n.º 1
0
    def run(self, args):
        """Run 'genconfig' subcommand."""

        setup_diagnostic_environment()

        optparser = GenConfigOptions(go_args=args, usage=self.usage_txt)
        if not validate_required_option(optparser.options):
            sys.stderr.write('Missing config options. Exiting.\n')
            return 1

        svc = ConfiguredMaster(optparser.options)
        try:
            setup_tasks(svc)
        except StandardError as err:
            self._log_and_raise(err)

        return 0
Ejemplo n.º 2
0
    def run(self, args):
        """Run 'genconfig' subcommand."""

        setup_diagnostic_environment()

        optparser = GenConfigOptions(go_args=args, usage=self.usage_txt)
        if not validate_required_option(optparser.options):
            sys.stderr.write('Missing config options. Exiting.\n')
            return 1

        svc = ConfiguredMaster(optparser.options)
        try:
            setup_tasks(svc)
            return 0
        except Exception as e:
            _log.error("Failed to setup hod tasks: %s", str(e))
            _log.exception("hod genconfig failed")
            sys.exit(1)
Ejemplo n.º 3
0
 def test_validate_fails_missing_dist_or_config(self):
     options = MagicMock(workdir='/')
     self.assertFalse(ho.validate_required_option(options))
Ejemplo n.º 4
0
 def test_validate_required_option(self):
     options = MagicMock(workdir='/', dist='Hadoop', hod_module='hod', hodconf=None)
     self.assertTrue(ho.validate_required_option(options))
Ejemplo n.º 5
0
 def test_validate_fails_missing_dist_or_config(self):
     options = MagicMock(workdir='/')
     self.assertFalse(ho.validate_required_option(options))
Ejemplo n.º 6
0
 def test_validate_required_option(self):
     options = MagicMock(workdir='/',
                         dist='Hadoop',
                         hod_module='hod',
                         hodconf=None)
     self.assertTrue(ho.validate_required_option(options))