示例#1
0
 def verify_security(self):
   """Verify the permissions on the sensitive configuration files."""
   ok = True
   for path in [
       self.__bindings.get('providers.google.primaryCredentials.jsonPath'),
       yml_or_yaml_path(self.__user_config_dir, 'spinnaker-local'),
       yml_or_yaml_path(self.__installation_config_dir,'spinnaker-local'),
       os.path.join(os.environ.get('HOME', '/root'),'.aws/credentials')]:
     ok = self.verify_user_access_only(path) and ok
   return ok
示例#2
0
    def validate(self):
        """Validate the configuration.

    Returns:
      True or False after print result to stdout
    """

        # TODO: Add more verification here
        # This is representative for the time being.
        self.verify_at_least_one_provider_enabled()
        self.verify_google_scopes()
        self.verify_external_dependencies()
        self.verify_security()

        found_local = False
        for ymldir in [self.__user_config_dir, self.__installation_config_dir]:
            yml_path = yml_or_yaml_path(ymldir, 'spinnaker-local')
            if not os.path.exists(yml_path):
                continue
            found_local = True

        if not found_local:
            self.__warnings.append(
                'There is no custom spinnaker-local.yml in either'
                ' "{user}" or "{install}"'.format(
                    user=self.__user_config_dir,
                    install=self.__installation_config_dir))

        if self.__warnings:
            print(
                '{path} has non-fatal configuration warnings:\n   * {warnings}'
                .format(path=yml_path,
                        warnings='\n   * '.join(self.__warnings)))

        if not self.__errors:
            print '{path} seems ok.'.format(path=yml_path)
            return True
        else:
            print('{path} has configuration errors:\n   * {errors}'.format(
                path=yml_path, errors='\n   * '.join(self.__errors)))
            return False
  def validate(self):
    """Validate the configuration.

    Returns:
      True or False after print result to stdout
    """

    # TODO: Add more verification here
    # This is representative for the time being.
    self.verify_at_least_one_provider_enabled()
    self.verify_google_scopes()
    self.verify_external_dependencies()
    self.verify_security()

    found_local = False   
    for ymldir in [self.__user_config_dir, self.__installation_config_dir]:
      yml_path = yml_or_yaml_path(ymldir, 'spinnaker-local')
      if not os.path.exists(yml_path):
        continue
      found_local = True

    if not found_local:
      self.__warnings.append(
          'There is no custom spinnaker-local.yml in either'
          ' "{user}" or "{install}"'.format(
               user=self.__user_config_dir,
               install=self.__installation_config_dir))

    if self.__warnings:
      print ('{path} has non-fatal configuration warnings:\n   * {warnings}'
             .format(path=yml_path, warnings='\n   * '.join(self.__warnings)))

    if not self.__errors:
      print '{path} seems ok.'.format(path=yml_path)
      return True
    else:
      print ('{path} has configuration errors:\n   * {errors}'
             .format(path=yml_path, errors='\n   * '.join(self.__errors)))
      return False