Пример #1
0
 def install(self, package):
     p = self.ctx.props
     r = self.ctx.r
     if os.path.exists(p.djm_package_file):
         djm_package_args = ["--djm-package=%s" % p.djm_package_file,]
         logger.debug("djm_package is %s" % p.djm_package_file)
     else:
         djm_package_args = []
         logger.debug("djm_package is None, did not find %s" %
                      p.djm_package_file)
     r(check_file_exists, p.djmctl)
     r(ensure_dir_exists, p.output_ports.djm_server.server_config_dir)
     cmd = [p.djmctl, "setup-server",
            "--server-config-dir=%s" % p.output_ports.djm_server.server_config_dir]
     cmd.extend(djm_package_args)
     r(run_program, cmd, cwd=p.output_ports.djm_server.server_config_dir)
     cmd = [p.djmctl, "set-server-directory",
            p.output_ports.djm_server.server_config_dir]
     r(run_program, cmd, cwd=p.output_ports.djm_server.server_config_dir)
     # add the current node as "master"
     machine_info = system_info.get_machine_info()
     ## cmd = [p.djmctl, "add-node"]
     ## cmd.append("--hostname=%s" % machine_info["hostname"])
     ## cmd.append("--os-user=%s" % machine_info["username"])
     ## if machine_info["private_ip"]!=None:
     ##     cmd.append("--private-ip=%s" % machine_info["private_ip"])
     ## if machine_info["public_ip"]!=None:
     ##     cmd.append("--public-ip=%s" % machine_info["public_ip"])
     ## cmd.append("master")
     cmd = [p.djmctl, "add-master-node", "--debug"]
     r(run_program, cmd, cwd=p.output_ports.djm_server.server_config_dir)
Пример #2
0
def get_target_machine_resource(deployment_home, log_directory):
    machine_info = system_info.get_machine_info(os_choices)
    if not machine_info.has_key("os"):
        raise UserError(errors[ERR_BAD_OS],
                        msg_args={"choices":os_choices})
    tr = system_info.get_target_machine_resource("master-host",
                                                 machine_info["hostname"],
                                                 machine_info["username"],
                                                 "GenForma/%s/sudo_password" % machine_info["username"],
                                                 machine_info["os"], machine_info["private_ip"])
    tr['config_port']['genforma_home'] = deployment_home
    tr['config_port']['log_directory'] = log_directory
    return tr
Пример #3
0
    def process_args(self, argv):
        from optparse import OptionParser
        parser = OptionParser()
        self.test_base_dir = os.path.dirname(engage.drivers.__file__)
        parser.add_option("--test-base-dir", dest="test_base_dir", default=None,
                          help="Base directory for test discovery (defaults to %s)" %
                                self.test_base_dir)
        parser.add_option("-l", "--list-tests", dest="list_tests", default=False,
                          action="store_true",
                          help="list driver tests that were found, but do not run them")
        parser.add_option("-t", "--tests", dest="tests", default=None,
                          help="List of tests to run (defaults to all)")
        parser.add_option("--deployment-home", dest="deployment_home", default=None,
                          help="Directory for deployment home (defaults to random)")
        parser.add_option("-r", "--run-driver", dest="run_driver", default=False,
                          action="store_true",
                          help="run the driver(s) in real install mode instead of dry_run mode")
        (opts, args) = parser.parse_args(argv)
        if opts.test_base_dir:
            self.test_base_dir = opts.test_base_dir
        self.test_base_dir = os.path.abspath(os.path.expanduser(self.test_base_dir))
        all_tests = find_driver_tsts(self.test_base_dir)
        if len(all_tests)==0:
            raise Exception("No driver tests found, discovery base directory was %s"
                            % self.test_base_dir)
        if opts.tests:
            test_names_to_files = {}
            for testfile in all_tests:
                test_names_to_files[driver_filename_to_tst_name(testfile)] = testfile
            self.tests = []
            for test in opts.tests.split(","):
                if not test_names_to_files.has_key(test):
                    raise Exception("Requested test %s not found" % test)
                self.tests.append(test_names_to_files[test])
        else:
            self.tests = all_tests
                
        if opts.deployment_home:
            self.dh = os.path.abspath(os.path.expanduser(ops.deployment_home))
        else:
            self.dh = tc.get_randomized_deploy_dir("test_drivers_")


        sys_info = system_info.get_machine_info(host_resource_utils.os_choices)
        self.hostname = sys_info['hostname']
        self.username = sys_info['username']
        
        if opts.list_tests:
            print [driver_filename_to_tst_name(test) for test in self.tests]
            sys.exit(0)