From 819af1cd224044cb25ec34d42f0449350edf41fc Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 2 May 2017 22:49:58 -0700 Subject: [PATCH] Cloud rename: amazon to AWS, google to GCP --- dvc/command/data_sync.py | 14 +++++++------- dvc/command/init.py | 4 ++-- dvc/config.py | 22 +++++++++++----------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dvc/command/data_sync.py b/dvc/command/data_sync.py index 612cbd7eb..8ce226c22 100644 --- a/dvc/command/data_sync.py +++ b/dvc/command/data_sync.py @@ -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) diff --git a/dvc/command/init.py b/dvc/command/init.py index 8fdf3fff0..4af5b8372 100644 --- a/dvc/command/init.py +++ b/dvc/command/init.py @@ -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 = ''' diff --git a/dvc/config.py b/dvc/config.py index 663f1f575..a7df6da27 100644 --- a/dvc/config.py +++ b/dvc/config.py @@ -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.')