Ejemplo n.º 1
0
  def __init__(self, config, environ_path, yml_path, aws_path):
      with open(environ_path, 'r') as f:
          self.__environ_content = f.read()
          if not self.__environ_content.endswith('\n'):
              self.__environ_content += '\n'

      with open(yml_path, 'r') as f:
          self.__output = f.read()

      self.__bindings = yaml_util.YamlBindings()
      self.__bindings.import_string(config)
      self.__write_yml_path = yml_path
      self.__write_aws_path = aws_path
      self.__write_environ_path = environ_path
Ejemplo n.º 2
0
  def find_new_port_and_address(self, subsystem):
    """This is assuming a specific configuration practice.

    Overrides for default ports only occur in ~/<subsystem>-local.yml
    or in ~/spinnaker-local.yml or in <install>/config/spinnnaker.yml

    The actual runtime uses spring, which can be overridden for additional
    search locations.
    """
    path = os.path.join(self.__installation.USER_CONFIG_DIR,
                        subsystem + '-local.yml')
    if os.path.exists(path):
       bindings = yaml_util.YamlBindings()
       bindings.import_dict(self.__bindings.map)
       bindings.import_path(path)
    else:
       bindings = self.__bindings

    subsystem = subsystem.replace('-', '_')
    return (bindings.get('services.{subsys}.port'.format(subsys=subsystem)),
            bindings.get('services.{subsys}.host'.format(subsys=subsystem)))