Пример #1
0
    def update(self, add_version=False, add_major=False, add_minor=False,
               new_extra=None):
        """
        Update the revision.

        The current directory should be git repository of Coral.

        :param add_version: Increase the version number. Default: False.
        :param add_major: Increase the major number. Default: False.
        :param add_minor: Increase the minor number. Default: True.
        :param new_extra: Change extra part of reviesion. Default: None. To
            remove the existing extra field, specify --new-extra "".
        :param update_license_key: Update the license key. If it is desired
            to the licenses of old versions, please specify this option.
        """
        # pylint: disable=no-self-use
        source_dir = os.getcwd()
        log, workspace = cmd_general.init_env_noconfig(source_dir,
                                                       self._cvc_log_to_file,
                                                       True)
        cmd_general.check_argument_bool(log, "add_version", add_version)
        cmd_general.check_argument_bool(log, "add_major", add_major)
        cmd_general.check_argument_bool(log, "add_minor", add_minor)
        if new_extra is not None:
            new_extra = cmd_general.check_argument_str(log, "new_extra",
                                                       new_extra)
            if "-" in new_extra:
                log.cl_error("character [-] is not allowed in extra field [%s]",
                             new_extra)
                cmd_general.cmd_exit(log, -1)
        rc = _update_version(log, workspace, source_dir,
                             add_version=add_version,
                             add_major=add_major, add_minor=add_minor,
                             new_extra=new_extra)
        cmd_general.cmd_exit(log, rc)
Пример #2
0
    def stop(self, host):
        """
        Stop Collectd service on the agent host.
        :param host: the name of the agent host. Could be a list.
        """
        log, barreleye_instance = init_env(self._bac_config_fpath,
                                           self._bac_logdir,
                                           self._bac_log_to_file)
        host = cmd_general.check_argument_str(log, "host", host)

        hostnames = cmd_general.parse_list_string(log, host)
        if hostnames is None:
            log.cl_error("host list [%s] is invalid", host)
            cmd_general.cmd_exit(log, -1)
        ret = barreleye_instance.bei_stop_agents(log, hostnames)
        cmd_general.cmd_exit(log, ret)
Пример #3
0
 def status(self, host):
     """
     Print the status of a agent host.
     :param host: the name of the agent host.
     """
     log, barreleye_instance = init_env(self._bac_config_fpath,
                                        self._bac_logdir,
                                        self._bac_log_to_file)
     host = cmd_general.check_argument_str(log, "host", host)
     if host not in barreleye_instance.bei_agent_dict:
         log.cl_error("host [%s] is not configured as Barreleye agent",
                      host)
         cmd_general.cmd_exit(log, -1)
     agent = barreleye_instance.bei_agent_dict[host]
     agents = [agent]
     ret = print_agents(log,
                        barreleye_instance,
                        agents,
                        status=True,
                        print_table=False)
     cmd_general.cmd_exit(log, ret)
Пример #4
0
def build(coral_command,
          cache=constant.CORAL_BUILD_CACHE,
          lustre=None,
          e2fsprogs=None,
          collectd=None,
          enable_zfs=False,
          enable_devel=False,
          disable_plugin=None,
          origin_mirror=False):
    """
    Build the Coral ISO.
    :param debug: Whether to dump debug logs into files, default: False.
    :param cache: The dir that caches build RPMs. Default:
        /var/log/coral/build_cache.
    :param lustre: The dir of Lustre RPMs (usually generated by lbuild).
        Default: /var/log/coral/build_cache/$type/lustre.
    :param e2fsprogs: The dir of E2fsprogs RPMs.
        Default: /var/log/coral/build_cache/$type/e2fsprogs.
    :param collectd: The Collectd source codes.
        Default: https://github.com/LiXi-storage/collectd/releases/$latest.
        A local source dir or .tar.bz2 generated by "make dist" of Collectd
        can be specified if modification to Collectd is needed.
    :param enable_zfs: Whether enable ZFS support. Default: False.
    :param enable_devel: Whether enable development support. Default: False.
    :param disable_plugin: Disable one or more plugins. Default: None.
    :param origin_mirror: Whether use origin Yum mirrors. If not use Tsinghua
        mirror for possible speedup. Default: False.
    """
    # pylint: disable=too-many-arguments,unused-argument,protected-access
    if not isinstance(coral_command._cc_log_to_file, bool):
        print("ERROR: invalid debug option [%s], should be a bool type" %
              (coral_command._cc_log_to_file),
              file=sys.stderr)
        sys.exit(1)

    source_dir = os.getcwd()
    identity = build_common.get_build_path()
    log, workspace = cmd_general.init_env_noconfig(
        source_dir, coral_command._cc_log_to_file, True, identity=identity)

    cache = cmd_general.check_argument_str(log, "cache", cache)
    if lustre is not None:
        lustre = cmd_general.check_argument_str(log, "lustre", lustre)
    if e2fsprogs is not None:
        e2fsprogs = cmd_general.check_argument_str(log, "e2fsprogs", e2fsprogs)
    if collectd is not None:
        collectd = cmd_general.check_argument_str(log, "collectd", collectd)
    cmd_general.check_argument_bool(log, "enable_zfs", enable_zfs)
    cmd_general.check_argument_bool(log, "enable_devel", enable_devel)
    if disable_plugin is not None:
        disable_plugin = cmd_general.check_argument_list_str(
            log, "disable_plugin", disable_plugin)
    cmd_general.check_argument_bool(log, "origin_mirror", origin_mirror)
    rc = coral_build.build(log,
                           source_dir,
                           workspace,
                           cache=cache,
                           lustre_rpms_dir=lustre,
                           e2fsprogs_rpms_dir=e2fsprogs,
                           collectd=collectd,
                           enable_zfs=enable_zfs,
                           enable_devel=enable_devel,
                           disable_plugin=disable_plugin,
                           origin_mirror=origin_mirror)
    cmd_general.cmd_exit(log, rc)