Esempio n. 1
0
def get_zone(options):
    """Determine the default availability zone.

    The default zone is the current zone if on GCE or an arbitrary zone.
    """
    if not options.zone:
        result = fetch(os.path.join(GOOGLE_INSTANCE_METADATA_URL, "zone"), google=True)
        if result.ok():
            options.zone = os.path.basename(result.content)
        else:
            options.zone = "us-central1-f"

    return options.zone
Esempio n. 2
0
def get_zone(options):
    """Determine the default availability zone.

    The default zone is the current zone if on GCE or an arbitrary zone.
    """
    if not options.zone:
        result = fetch(os.path.join(GOOGLE_INSTANCE_METADATA_URL, 'zone'),
                       google=True)
        if result.ok():
            options.zone = os.path.basename(result.content)
        else:
            options.zone = 'us-central1-f'

    return options.zone
Esempio n. 3
0
    def start_all(self, options):
        """Starts all the components then logs stderr to the console forever.

    The subsystems are in forked processes disassociated from this, so will
    continue running even after this process exists. Only the stderr logging
    to console will stop once this process is terminated. However, the
    logging will still continue into the LOG_DIR.
    """

        ValidateConfig(self.configurator).check_validate()
        self.configurator.update_deck_settings()

        ignore_tail_jobs = self.tail_error_logs()
        super(DevRunner, self).start_all(options)

        deck_port = self.installation.DECK_PORT
        print 'Waiting for deck to start on port {port}'.format(port=deck_port)

        # Tail the log file while we wait and run.
        # But the log file might not yet exist if deck hasn't started yet.
        # So wait for the log file to exist before starting to tail it.
        # Deck cant be ready yet if it hasn't started yet anyway.
        deck_log_path = os.path.join(self.installation.LOG_DIR, 'deck.log')
        while not os.path.exists(deck_log_path):
            time.sleep(0.1)
        ignore_tail_jobs.append(self.start_tail(deck_log_path))

        # Don't just wait for port to be ready,  but for deck to respond
        # because it takes a long time to startup once port is ready.
        while True:
            code, ignore = fetch(
                'http://localhost:{port}/'.format(port=deck_port))
            if code == 200:
                break
            else:
                time.sleep(0.1)

        print """Spinnaker is now ready on port {port}.

You can ^C (ctrl-c) to finish the script, which will stop emitting errors.
Spinnaker will continue until you run ./spinnaker/dev/stop_dev.sh
""".format(port=deck_port)

        while True:
            time.sleep(3600)
Esempio n. 4
0
  def start_all(self, options):
    """Starts all the components then logs stderr to the console forever.

    The subsystems are in forked processes disassociated from this, so will
    continue running even after this process exists. Only the stderr logging
    to console will stop once this process is terminated. However, the
    logging will still continue into the LOG_DIR.
    """

    ValidateConfig(self.configurator).check_validate()
    self.configurator.update_deck_settings()

    ignore_tail_jobs = self.tail_error_logs()
    super(DevRunner, self).start_all(options)

    deck_port = self.installation.DECK_PORT
    print 'Waiting for deck to start on port {port}'.format(port=deck_port)

    # Tail the log file while we wait and run.
    # But the log file might not yet exist if deck hasn't started yet.
    # So wait for the log file to exist before starting to tail it.
    # Deck cant be ready yet if it hasn't started yet anyway.
    deck_log_path = os.path.join(self.installation.LOG_DIR, 'deck.log')
    while not os.path.exists(deck_log_path):
      time.sleep(0.1)
    ignore_tail_jobs.append(self.start_tail(deck_log_path))

    # Don't just wait for port to be ready,  but for deck to respond
    # because it takes a long time to startup once port is ready.
    while True:
      code, ignore = fetch('http://localhost:{port}/'.format(port=deck_port))
      if code == 200:
        break
      else:
        time.sleep(0.1)

    print """Spinnaker is now ready on port {port}.

You can ^C (ctrl-c) to finish the script, which will stop emitting errors.
Spinnaker will continue until you run ./spinnaker/dev/stop_dev.sh
""".format(port=deck_port)

    while True:
      time.sleep(3600)