def __init__(self, service, base_path, logger, s3_resource=None):
    """
    Args:
      service: "s3" or "file" -- use S3 in AWS, and "file" in local dev
      base_path: prefix of the path to the config bucket:
        for s3: "all" or "<service>"
        for file: "/vagrant/configs/<"all"|<service>>
      logger: an function that will log messages from here
      s3_resource: if s3, a boto3 s3 resource
    """
    self.service = service
    self.base_path = base_path
    self.logger = logger
    self.s3_resource = s3_resource
    self.template_prefix = self.base_path + "/templates/"
    self.current = None

    self.items = []
    if self.service == "s3":
      bucket = self.s3_resource.Bucket(EFConfig.S3_CONFIG_BUCKET)
      bucket_objects = bucket.objects.filter(Prefix=self.template_prefix)
      # unpack into a list for easier iteration
      for bucket_object in bucket_objects:
        self.items.append(bucket_object)
    elif self.service == "file":
      for _path, _dir, _files in walk(self.template_prefix):
        for _file in _files:
          self.items.append("{}{}".format(_path, _file))
    else:
      raise ValueError("invalid service: {} in EFInstanceinitConfigReader; valid: 's3','file'".format(self.service))
def __init__ ( self , service , base_path , logger , s3_resource = None ) : self . service = service self . base_path = base_path self . logger = logger self . s3_resource = s3_resource self . template_prefix = self . base_path + "/templates/" self . current = None self . items = [ ] if self . service == "s3" : bucket = self . s3_resource . Bucket ( EFConfig . S3_CONFIG_BUCKET ) bucket_objects = bucket . objects . filter ( Prefix = self . template_prefix ) for bucket_object in bucket_objects : self . items . append ( bucket_object ) elif self . service == "file" : for _path , _dir , _files in walk ( self . template_prefix ) : for _file in _files : self . items . append ( "{}{}" . format ( _path , _file ) ) else : raise ValueError ( "invalid service: {} in EFInstanceinitConfigReader; valid: 's3','file'" . format ( self . service ) )
Args:
      service: "s3" or "file" -- use S3 in AWS, and "file" in local dev
      base_path: prefix of the path to the config bucket:
        for s3: "all" or "<service>"
        for file: "/vagrant/configs/<"all"|<service>>
      logger: an function that will log messages from here
      s3_resource: if s3, a boto3 s3 resource