Example #1
0
 def __init__(self, host=None):
     self.host = host
     self.got = False
     self.installed = False
     self.serverdir = utils.get_server_dir()
     self.os_vendor = client_utils.get_os_vendor()
     self.server_system_wide_install = _server_system_wide_install()
     super(BaseAutotest, self).__init__()
    def _initialize(self, target_file_owner=None, *args, **dargs):
        super(Host, self)._initialize(*args, **dargs)

        self.serverdir = utils.get_server_dir()
        self.monitordir = os.path.join(os.path.dirname(__file__), "monitors")
        self.bootloader = bootloader.Bootloader(self)
        self.env = {}
        self.target_file_owner = target_file_owner
 def __init__(self, host=None):
     self.host = host
     self.got = False
     self.installed = False
     self.serverdir = utils.get_server_dir()
     self.os_vendor = client_utils.get_os_vendor()
     self.server_system_wide_install = _server_system_wide_install()
     super(BaseAutotest, self).__init__()
Example #4
0
    def _initialize(self, target_file_owner=None,
                    *args, **dargs):
        super(Host, self)._initialize(*args, **dargs)

        self.serverdir = utils.get_server_dir()
        self.monitordir = os.path.join(os.path.dirname(__file__), "monitors")
        self.bootloader = bootloader.Bootloader(self)
        self.env = {}
        self.target_file_owner = target_file_owner
Example #5
0
    def _get_conmux_attach(cls, conmux_attach=None):
        if conmux_attach:
            return conmux_attach

        # assume we're using the conmux-attach provided with autotest
        server_dir = server_utils.get_server_dir()
        path = os.path.join(server_dir, "..", "conmux", "conmux-attach")
        path = os.path.abspath(path)
        return path
Example #6
0
 def _install_boottool(self):
     """
     Installs boottool on the host
     """
     if self._host() is None:
         raise error.AutoservError("Host does not exist anymore")
     tmpdir = self._host().get_tmp_dir()
     self._host().send_file(os.path.abspath(os.path.join(utils.get_server_dir(), BOOTTOOL_CLI_PATH)), tmpdir)
     self._boottool_path = os.path.join(tmpdir, os.path.basename(BOOTTOOL_CLI_PATH))
Example #7
0
 def _install_boottool(self):
     '''
     Installs boottool on the host
     '''
     if self._host() is None:
         raise error.AutoservError(
             "Host does not exist anymore")
     tmpdir = self._host().get_tmp_dir()
     self._host().send_file(os.path.abspath(os.path.join(
         utils.get_server_dir(), BOOTTOOL_CLI_PATH)), tmpdir)
     self._boottool_path = os.path.join(tmpdir,
                                        os.path.basename(BOOTTOOL_CLI_PATH))
Example #8
0
    def _get_conmux_attach(cls, conmux_attach=None):
        if conmux_attach:
            return conmux_attach

        # Try to find conmux installed system wide first
        if os.path.exists('/usr/bin/conmux-attach'):
            path = '/usr/bin/conmux-attach'
        else:
            # assume we're using the conmux-attach provided with autotest
            server_dir = server_utils.get_server_dir()
            path = os.path.join(server_dir, os.pardir, "conmux", "conmux-attach")
            path = os.path.abspath(path)
        return path
Example #9
0
 def __init__(self, host=None):
     self.host = host
     self.got = False
     self.installed = False
     self.serverdir = utils.get_server_dir()
     super(BaseAutotest, self).__init__()
Example #10
0
def main():
    # get options and args
    options, args = parse_args()

    server_dir = server_utils.get_server_dir()
    autotest_dir = os.path.abspath(os.path.join(server_dir, '..'))

    # extract the pkg locations from global config
    repo_urls = c.get_config_value('PACKAGES', 'fetch_location',
                                   type=list, default=[])
    upload_paths = c.get_config_value('PACKAGES', 'upload_location',
                                      type=list, default=[])

    if options.repo:
        upload_paths.append(options.repo)

    # Having no upload paths basically means you're not using packaging.
    if not upload_paths:
        print("No upload locations found. Please set upload_location under"
              " PACKAGES in the global_config.ini or provide a location using"
              " the --repository option.")
        return

    client_dir = os.path.join(autotest_dir, "client")

    # Bail out if the client directory does not exist
    if not os.path.exists(client_dir):
        sys.exit(0)

    dep_dir = os.path.join(client_dir, "deps")
    prof_dir = os.path.join(client_dir, "profilers")

    if len(args) == 0 or args[0] not in ['upload', 'remove']:
        print("Either 'upload' or 'remove' needs to be specified "
              "for the package")
        sys.exit(0)

    if args[0] == 'upload':
        remove_flag = False
    elif args[0] == 'remove':
        remove_flag = True
    else:
        # we should not be getting here
        assert(False)

    pkgmgr = packages.PackageManager(autotest_dir, repo_urls=repo_urls,
                                     upload_paths=upload_paths,
                                     run_function_dargs={'timeout':600})

    if options.all:
        process_all_packages(pkgmgr, client_dir, remove=remove_flag)

    if options.client:
        process_packages(pkgmgr, 'client', 'autotest', client_dir,
                         remove=remove_flag)

    if options.dep:
        process_packages(pkgmgr, 'dep', options.dep, dep_dir,
                         remove=remove_flag)

    if options.test:
        process_packages(pkgmgr, 'test', options.test, client_dir,
                         remove=remove_flag)

    if options.prof:
        process_packages(pkgmgr, 'profiler', options.prof, prof_dir,
                         remove=remove_flag)

    if options.file:
        if remove_flag:
            pkgmgr.remove_pkg(options.file, remove_checksum=True)
        else:
            pkgmgr.upload_pkg(options.file, update_checksum=True)
Example #11
0
def main():
    # get options and args
    options, args = parse_args()

    server_dir = server_utils.get_server_dir()
    autotest_dir = os.path.abspath(os.path.join(server_dir, '..'))

    # extract the pkg locations from global config
    repo_urls = settings.get_value('PACKAGES',
                                   'fetch_location',
                                   type=list,
                                   default=[])
    upload_paths = settings.get_value('PACKAGES',
                                      'upload_location',
                                      type=list,
                                      default=[])

    if options.repo:
        upload_paths.append(options.repo)

    # Having no upload paths basically means you're not using packaging.
    if not upload_paths:
        print(
            "No upload locations found. Please set upload_location under"
            " PACKAGES in the global_config.ini or provide a location using"
            " the --repository option.")
        return

    client_dir = os.path.join(autotest_dir, "client")

    # Bail out if the client directory does not exist
    if not os.path.exists(client_dir):
        sys.exit(0)

    dep_dir = os.path.join(client_dir, "deps")
    prof_dir = os.path.join(client_dir, "profilers")

    if len(args) == 0 or args[0] not in ['upload', 'remove']:
        print(
            "Either 'upload' or 'remove' needs to be specified "
            "for the package")
        sys.exit(0)

    if args[0] == 'upload':
        remove_flag = False
    elif args[0] == 'remove':
        remove_flag = True
    else:
        # we should not be getting here
        assert (False)

    pkgmgr = packages.PackageManager(autotest_dir,
                                     repo_urls=repo_urls,
                                     upload_paths=upload_paths,
                                     run_function_dargs={'timeout': 600})

    if options.all:
        process_all_packages(pkgmgr, client_dir, remove=remove_flag)

    if options.client:
        process_packages(pkgmgr,
                         'client',
                         'autotest',
                         client_dir,
                         remove=remove_flag)

    if options.dep:
        process_packages(pkgmgr,
                         'dep',
                         options.dep,
                         dep_dir,
                         remove=remove_flag)

    if options.test:
        process_packages(pkgmgr,
                         'test',
                         options.test,
                         client_dir,
                         remove=remove_flag)

    if options.prof:
        process_packages(pkgmgr,
                         'profiler',
                         options.prof,
                         prof_dir,
                         remove=remove_flag)

    if options.file:
        if remove_flag:
            pkgmgr.remove_pkg(options.file, remove_checksum=True)
        else:
            pkgmgr.upload_pkg(options.file, update_checksum=True)
Example #12
0
 def __init__(self, host=None):
     self.host = host
     self.got = False
     self.installed = False
     self.serverdir = utils.get_server_dir()
     super(BaseAutotest, self).__init__()