Beispiel #1
0
 def __init__(self):
     ScriptBase.__init__(self)
     self.wdir = boto.config.get('Pyami', 'working_dir')
     self.log_file = '%s.log' % self.instance_id
     self.log_path = os.path.join(self.wdir, self.log_file)
     boto.set_file_logger(self.name, self.log_path)
     self.src_name = boto.config.get(self.name, 'src_bucket')
     self.dst_name = boto.config.get(self.name, 'dst_bucket')
     self.replace = boto.config.getbool(self.name, 'replace_dst', True)
     s3 = boto.connect_s3()
     self.src = s3.lookup(self.src_name)
     if not self.src:
         boto.log.error('Source bucket does not exist: %s' % self.src_name)
     dest_access_key = boto.config.get(self.name, 'dest_aws_access_key_id', None)
     if dest_access_key:
         dest_secret_key = boto.config.get(self.name, 'dest_aws_secret_access_key', None)
         s3 = boto.connect(dest_access_key, dest_secret_key)
     self.dst = s3.lookup(self.dst_name)
     if not self.dst:
         self.dst = s3.create_bucket(self.dst_name)
Beispiel #2
0
 def __init__(self):
     super(CopyBot, self).__init__()
     self.wdir = boto.config.get('Pyami', 'working_dir')
     self.log_file = '%s.log' % self.instance_id
     self.log_path = os.path.join(self.wdir, self.log_file)
     boto.set_file_logger(self.name, self.log_path)
     self.src_name = boto.config.get(self.name, 'src_bucket')
     self.dst_name = boto.config.get(self.name, 'dst_bucket')
     self.replace = boto.config.getbool(self.name, 'replace_dst', True)
     s3 = boto.connect_s3()
     self.src = s3.lookup(self.src_name)
     if not self.src:
         boto.log.error('Source bucket does not exist: %s' % self.src_name)
     dest_access_key = boto.config.get(self.name, 'dest_aws_access_key_id', None)
     if dest_access_key:
         dest_secret_key = boto.config.get(self.name, 'dest_aws_secret_access_key', None)
         s3 = boto.connect(dest_access_key, dest_secret_key)
     self.dst = s3.lookup(self.dst_name)
     if not self.dst:
         self.dst = s3.create_bucket(self.dst_name)
Beispiel #3
0
 def __init__(self, bucket_name, key=None, secret=None):
     if key and secret:
         self._s3 = boto.connect_s3(key, secret)
     else:
         self._s3 = boto.connect()
     self._bucket = self._s3.get_bucket(bucket_name)
Beispiel #4
0
 def __init__(self, bucket_name, key=None, secret=None):
     if key and secret:
         self._s3 = boto.connect_s3(key, secret)
     else:
         self._s3 = boto.connect()
     self._bucket = self._s3.get_bucket(bucket_name)