コード例 #1
0
ファイル: script.py プロジェクト: screeley44/ambari
  def install_packages(self, env, exclude_packages=[]):
    """
    List of packages that are required< by service is received from the server
    as a command parameter. The method installs all packages
    from this list
    """
    config = self.get_config()
    try:
      package_list_str = config['hostLevelParams']['package_list']
      if isinstance(package_list_str, basestring) and len(package_list_str) > 0:
        package_list = json.loads(package_list_str)
        for package in package_list:
          if not package['name'] in exclude_packages:
            name = package['name']
            if OSCheck.is_windows_family():
              if name[-4:] == ".msi":
                #TODO all msis must be located in resource folder of server, change it to repo later
                Msi(name, http_source=os.path.join(config['hostLevelParams']['jdk_location']))
            else:
              Package(name)
    except KeyError:
      pass  # No reason to worry

    if OSCheck.is_windows_family():
      #TODO hacky install of windows msi, remove it or move to old(2.1) stack definition when component based install will be implemented
      install_windows_msi(os.path.join(config['hostLevelParams']['jdk_location'], "hdp.msi"),
                          config["hostLevelParams"]["agentCacheDir"], "hdp.msi", self.get_password("hadoop"),
                          str(config['hostLevelParams']['stack_version']))
      reload_windows_env()
    # RepoInstaller.remove_repos(config)
    pass
コード例 #2
0
ファイル: script.py プロジェクト: fanzhidongyzby/ambari
  def install_packages(self, env, exclude_packages=[]):
    """
    List of packages that are required< by service is received from the server
    as a command parameter. The method installs all packages
    from this list
    """
    config = self.get_config()
    try:
      package_list_str = config['hostLevelParams']['package_list']
      if isinstance(package_list_str, basestring) and len(package_list_str) > 0:
        package_list = json.loads(package_list_str)
        for package in package_list:
          if not package['name'] in exclude_packages:
            name = package['name']
            if OSCheck.is_windows_family():
              if name[-4:] == ".msi":
                #TODO all msis must be located in resource folder of server, change it to repo later
                Msi(name, http_source=os.path.join(config['hostLevelParams']['jdk_location']))
            else:
              Package(name)
    except KeyError:
      pass  # No reason to worry

    if OSCheck.is_windows_family():
      #TODO hacky install of windows msi, remove it or move to old(2.1) stack definition when component based install will be implemented
      install_windows_msi(os.path.join(config['hostLevelParams']['jdk_location'], "hdp.msi"),
                          config["hostLevelParams"]["agentCacheDir"], "hdp.msi", self.get_password("hadoop"),
                          str(config['hostLevelParams']['stack_version']))
      reload_windows_env()
    pass
コード例 #3
0
    def install_packages(self, env, exclude_packages=[]):
        """
    List of packages that are required< by service is received from the server
    as a command parameter. The method installs all packages
    from this list
    
    exclude_packages - list of regexes (possibly raw strings as well), the
    packages which match the regex won't be installed.
    NOTE: regexes don't have Python syntax, but simple package regexes which support only * and .* and ?
    """
        config = self.get_config()
        if 'host_sys_prepped' in config['hostLevelParams']:
            # do not install anything on sys-prepped host
            if config['hostLevelParams']['host_sys_prepped'] == True:
                Logger.info("Node has all packages pre-installed. Skipping.")
                return
            pass
        try:
            package_list_str = config['hostLevelParams']['package_list']
            if isinstance(package_list_str,
                          basestring) and len(package_list_str) > 0:
                package_list = json.loads(package_list_str)
                for package in package_list:
                    if not Script.matches_any_regexp(package['name'],
                                                     exclude_packages):
                        name = package['name']
                        # HACK: On Windows, only install ambari-metrics packages using Choco Package Installer
                        # TODO: Update this once choco packages for hadoop are created. This is because, service metainfo.xml support
                        # <osFamily>any<osFamily> which would cause installation failure on Windows.
                        if OSCheck.is_windows_family():
                            if "ambari-metrics" in name:
                                Package(name)
                        else:
                            Package(name)
        except KeyError:
            pass  # No reason to worry

        if OSCheck.is_windows_family():
            #TODO hacky install of windows msi, remove it or move to old(2.1) stack definition when component based install will be implemented
            hadoop_user = config["configurations"]["cluster-env"][
                "hadoop.user.name"]
            install_windows_msi(
                config['hostLevelParams']['jdk_location'],
                config["hostLevelParams"]["agentCacheDir"], [
                    "hdp-2.3.0.0.winpkg.msi", "hdp-2.3.0.0.cab",
                    "hdp-2.3.0.0-01.cab"
                ], hadoop_user, self.get_password(hadoop_user),
                str(config['hostLevelParams']['stack_version']))
            reload_windows_env()
コード例 #4
0
ファイル: script.py プロジェクト: elal/ambari
    def install_packages(self, env, exclude_packages=[]):
        """
    List of packages that are required< by service is received from the server
    as a command parameter. The method installs all packages
    from this list
    """
        config = self.get_config()
        if 'host_sys_prepped' in config['hostLevelParams']:
            # do not install anything on sys-prepped host
            if config['hostLevelParams']['host_sys_prepped'] == True:
                Logger.info("Node has all packages pre-installed. Skipping.")
                return
            pass
        try:
            package_list_str = config['hostLevelParams']['package_list']
            if isinstance(package_list_str,
                          basestring) and len(package_list_str) > 0:
                package_list = json.loads(package_list_str)
                for package in package_list:
                    if not package['name'] in exclude_packages:
                        name = package['name']
                        if OSCheck.is_windows_family():
                            if name[-4:] == ".msi":
                                #TODO all msis must be located in resource folder of server, change it to repo later
                                Msi(name,
                                    http_source=os.path.join(
                                        config['hostLevelParams']
                                        ['jdk_location']))
                        else:
                            Package(name)
        except KeyError:
            pass  # No reason to worry

        if OSCheck.is_windows_family():
            #TODO hacky install of windows msi, remove it or move to old(2.1) stack definition when component based install will be implemented
            hadoop_user = config["configurations"]["cluster-env"][
                "hadoop.user.name"]
            install_windows_msi(
                os.path.join(config['hostLevelParams']['jdk_location'],
                             "hdp.msi"),
                config["hostLevelParams"]["agentCacheDir"], "hdp.msi",
                hadoop_user, self.get_password(hadoop_user),
                str(config['hostLevelParams']['stack_version']))
            reload_windows_env()
        pass
コード例 #5
0
  def install_packages(self, env, exclude_packages=[]):
    """
    List of packages that are required< by service is received from the server
    as a command parameter. The method installs all packages
    from this list
    
    exclude_packages - list of regexes (possibly raw strings as well), the
    packages which match the regex won't be installed.
    NOTE: regexes don't have Python syntax, but simple package regexes which support only * and .* and ?
    """
    config = self.get_config()
    if 'host_sys_prepped' in config['hostLevelParams']:
      # do not install anything on sys-prepped host
      if config['hostLevelParams']['host_sys_prepped'] == True:
        Logger.info("Node has all packages pre-installed. Skipping.")
        return
      pass
    try:
      package_list_str = config['hostLevelParams']['package_list']
      if isinstance(package_list_str, basestring) and len(package_list_str) > 0:
        package_list = json.loads(package_list_str)
        for package in package_list:
          if not Script.matches_any_regexp(package['name'], exclude_packages):
            name = package['name']
            # HACK: On Windows, only install ambari-metrics packages using Choco Package Installer
            # TODO: Update this once choco packages for hadoop are created. This is because, service metainfo.xml support
            # <osFamily>any<osFamily> which would cause installation failure on Windows.
            if OSCheck.is_windows_family():
              if "ambari-metrics" in name:
                Package(name)
            else:
              Package(name)
    except KeyError:
      pass  # No reason to worry

    if OSCheck.is_windows_family():
      #TODO hacky install of windows msi, remove it or move to old(2.1) stack definition when component based install will be implemented
      hadoop_user = config["configurations"]["cluster-env"]["hadoop.user.name"]
      install_windows_msi(config['hostLevelParams']['jdk_location'],
                          config["hostLevelParams"]["agentCacheDir"], ["hdp-2.3.0.0.winpkg.msi", "hdp-2.3.0.0.cab", "hdp-2.3.0.0-01.cab"],
                          hadoop_user, self.get_password(hadoop_user),
                          str(config['hostLevelParams']['stack_version']))
      reload_windows_env()