mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-01 23:08:43 +01:00
Cloud rename: amazon to AWS, google to GCP
This commit is contained in:
@@ -108,7 +108,7 @@ class CmdDataSync(CmdBase):
|
||||
bucket_name = self.config.storage_bucket
|
||||
bucket = conn.lookup(bucket_name)
|
||||
if bucket is None:
|
||||
raise DataSyncError('Bucket "{}" can\'t be accessed'.format(bucket_name))
|
||||
raise DataSyncError('Storage path is not setup correctly')
|
||||
return bucket
|
||||
|
||||
def _sync_from_cloud_aws(self, item):
|
||||
@@ -197,18 +197,18 @@ class CmdDataSync(CmdBase):
|
||||
|
||||
def sync_from_cloud(self, item):
|
||||
cloud = self.settings.config.cloud
|
||||
assert cloud in ['amazon', 'google'], 'unknown cloud %s' % cloud
|
||||
if cloud == 'amazon':
|
||||
assert cloud in ['aws', 'gcp'], 'unknown cloud %s' % cloud
|
||||
if cloud == 'aws':
|
||||
return self._sync_from_cloud_aws(item)
|
||||
elif cloud == 'google':
|
||||
elif cloud == 'gcp':
|
||||
return self._sync_from_cloud_gcp(item)
|
||||
|
||||
def sync_to_cloud(self, data_item):
|
||||
cloud = self.settings.config.cloud
|
||||
assert cloud in ['amazon', 'google'], 'unknown cloud %s' % cloud
|
||||
if cloud == 'amazon':
|
||||
assert cloud in ['aws', 'gcp'], 'unknown cloud %s' % cloud
|
||||
if cloud == 'aws':
|
||||
return self._sync_to_cloud_aws(data_item)
|
||||
elif cloud == 'google':
|
||||
elif cloud == 'gcp':
|
||||
return self._sync_to_cloud_gcp(data_item)
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ class CmdInit(CmdBase):
|
||||
DataDir = {}
|
||||
CacheDir = {}
|
||||
StateDir = {}
|
||||
Cloud = amazon
|
||||
Cloud = AWS
|
||||
StoragePath =
|
||||
|
||||
# Log levels: Debug, Info, Warning and Error
|
||||
@@ -48,7 +48,7 @@ KeyName = dvc-key
|
||||
|
||||
SecurityGroup = dvc-group
|
||||
|
||||
[GC]
|
||||
[GCP]
|
||||
StoragePath =
|
||||
ProjectName =
|
||||
'''
|
||||
|
||||
+11
-11
@@ -121,11 +121,11 @@ class Config(ConfigI):
|
||||
return path
|
||||
|
||||
cloud = self.cloud
|
||||
assert cloud in ['amazon', 'google'], 'unknown cloud %s' % cloud
|
||||
if cloud == 'amazon':
|
||||
assert cloud in ['aws', 'gcp'], 'unknown cloud %s' % cloud
|
||||
if cloud == 'aws':
|
||||
path = self._config['AWS'].get('StoragePath', None)
|
||||
elif cloud == 'google':
|
||||
path = self._config['GC'].get('StoragePath', None)
|
||||
elif cloud == 'gcp':
|
||||
path = self._config['GCP'].get('StoragePath', None)
|
||||
if path is None:
|
||||
raise ConfigError('invalid StoragePath: not set for Data or cloud specific')
|
||||
return path
|
||||
@@ -151,12 +151,12 @@ class Config(ConfigI):
|
||||
|
||||
@property
|
||||
def cloud(self):
|
||||
""" get cloud choice: currently one of ['amazon', 'google'] """
|
||||
""" get cloud choice: currently one of ['AWS', 'GCP'] """
|
||||
conf = self._config['Global'].get('Cloud', '')
|
||||
if conf.lower() in ['amazon', 'aws']:
|
||||
return 'amazon'
|
||||
if conf.lower() in ['gc', 'google', 'google cloud', 'googlecloud']:
|
||||
return 'google'
|
||||
if conf.lower() in ['aws']:
|
||||
return 'aws'
|
||||
if conf.lower() in ['gcp']:
|
||||
return 'gcp'
|
||||
return conf
|
||||
|
||||
|
||||
@@ -231,12 +231,12 @@ class Config(ConfigI):
|
||||
if cloud == '':
|
||||
# not set; already complained above
|
||||
pass
|
||||
elif cloud == 'amazon':
|
||||
elif cloud == 'aws':
|
||||
creds = self.get_aws_credentials()
|
||||
if creds is None:
|
||||
errors.append('can\'t find aws credentials.')
|
||||
self._aws_creds = creds
|
||||
elif cloud == 'google':
|
||||
elif cloud == 'gcp':
|
||||
project = self._config['GC'].get('ProjectName', None)
|
||||
if project is None or len(project) < 1:
|
||||
errors.append('can\'t read google cloud project name. Please set ProjectName in section GC.')
|
||||
|
||||
Reference in New Issue
Block a user