Beispiel #1
0
 def _validate_config(self):
     if not self.config.get('keyfile'):
         msg = ('The path to a Service Account JSON keyfile is required to '
                'authenticate to Google Compute Engine and Cloud '
                'Resource Manager.')
         logging.error(msg)
         raise exceptions.GCPConfigError(msg)
     if not self.config.get('dns_zone'):
         msg = ('The DNS zone name, i.e. "example.com", is required to '
                'identify to which zone generated records should belong.')
         logging.error(msg)
         raise exceptions.GCPConfigError(msg)
Beispiel #2
0
 def _validate_config(self):
     # req keys: keyfile, project, topic
     # TODO (lynn): keyfile won't be required once we support other
     #              auth methods
     if not self.config.get('keyfile'):
         msg = ('The path to a Service Account JSON keyfile is required to '
                'authenticate for Google Cloud Pub/Sub.')
         logging.error(msg)
         raise exceptions.GCPConfigError(msg)
     if not self.config.get('project'):
         msg = 'The GCP project where Cloud DNS is located is required.'
         logging.error(msg)
         raise exceptions.GCPConfigError(msg)
Beispiel #3
0
    def _validate_config(self):
        # req keys: keyfile, project, topic
        # TODO (lynn): keyfile won't be required once we support other
        #              auth methods
        if not self.config.get('keyfile'):
            msg = ('The path to a Service Account JSON keyfile is required to '
                   'authenticate for Google Cloud Pub/Sub.')
            logging.error(msg)
            raise exceptions.GCPConfigError(msg)
        if not self.config.get('project'):
            msg = 'The GCP project where Cloud Pub/Sub is located is required.'
            logging.error(msg)
            raise exceptions.GCPConfigError(msg)
        if not self.config.get('topic'):
            msg = ('A topic for the client to publish to in Cloud Pub/Sub is '
                   'required.')
            logging.error(msg)
            raise exceptions.GCPConfigError(msg)

        topic_prefix = f'projects/{self.config["project"]}/topics/'
        if not self.config.get('topic').startswith(topic_prefix):
            self.config['topic'] = f'{topic_prefix}{self.config["topic"]}'