def __deferred_init(self): """ Init all data that requires external resources """ if self.__inited: return logger.info("Getting API URLs from well-known {}".format( self.__discovery_url)) self.secret_manager = secret.Manager() self.config = common.get_config() self.__well_known = WellKnown(self.__discovery_url) wk = self.__well_known.get_well_known() self.api_url = wk["api"]["endpoints"] # XXX These are not currently used # self.api_audience = wk["api"]["audience"] # self.api_url_person = self.api_url["person"] # self.api_url_change = self.api_url["change"] self.api_audience = self.config("api_identifier", namespace="cis", default="api.dev.sso.allizom.org") self.api_url_person = "https://" + self.config( "person_api_url", namespace="cis", default="person.api.dev.sso.allizom.org") self.api_url_change = "https://" + self.config( "change_api_url", namespace="cis", default="change.api.dev.sso.allizom.org") self.publisher_rules = self.__well_known.get_publisher_rules() self.__inited = True
def __init__(self): self.config = common.get_config() self.region_name = self.config("secret_manager_ssm_region", namespace="cis", default="us-west-2") self.boto_session = boto3.session.Session(region_name=self.region_name) self.ssm_client = self.boto_session.client("ssm")
def setup_class(self): os.environ["CIS_CONFIG_INI"] = "tests/mozilla-cis.ini" from cis_publisher.common import get_config os.environ["CIS_KINESALITE_PORT"] = str(random.randint(32000, 34000)) os.environ["CIS_REQUESTS_CACHE_BACKEND"] = "memory" config = get_config() self.kinesalite_port = config("kinesalite_port", namespace="cis") self.kinesaliteprocess = subprocess.Popen( ["kinesalite", "--port", self.kinesalite_port], preexec_fn=os.setsid) stub = Stubber(boto3.session.Session(region_name="us-west-2")) conn = stub.client.client("kinesis", endpoint_url="http://localhost:{}".format( self.kinesalite_port)) try: name = "local-stream" conn.create_stream(StreamName=name, ShardCount=1) except ResourceInUseException: # This just means we tried too many tests too fast. pass except ClientError: pass waiter = conn.get_waiter("stream_exists") waiter.wait(StreamName=name, Limit=100, WaiterConfig={ "Delay": 5, "MaxAttempts": 5 }) tags_1 = {"Key": "cis_environment", "Value": "local"} tags_2 = {"Key": "application", "Value": "change-stream"} conn.add_tags_to_stream(StreamName=name, Tags=tags_1) conn.add_tags_to_stream(StreamName=name, Tags=tags_2)
def __init__(self): self.config = get_config() self.connection_object = connect.AWS() self.kinesis_client = None self.wk = cis_profile.common.WellKnown() self.schema = self.wk.get_schema()
def __init__(self, user_id=None, primary_email="", access_token=""): self.access_token = access_token self.config = get_config() self.user_id = quote_plus(user_id) self.primary_email = quote_plus(primary_email) self.user_profile = None