def source_clone(self): ''' Clone the charts source We only support a git source type right now, which can also handle git:// local paths as well ''' subpath = self.chart.source.get('subpath', '') if not self.chart.source.type: LOG.exception("Unknown source type %s for chart %s", self.chart.name, self.chart.source.type) return if self.parent: LOG.info("Cloning %s/%s as dependency for %s", self.chart.source.location, subpath, self.parent) else: LOG.info("Cloning %s/%s for release %s", self.chart.source.location, subpath, self.chart.name) if self.chart.source.type == 'git': self._source_tmp_dir = repo.git_clone(self.chart.source.location, self.chart.source.reference) if self.chart.source.type == 'repo': self._source_tmp_dir = repo.from_repo(self.chart.source.location, self.chart.name, self.chart.version) return os.path.join(self._source_tmp_dir, subpath)
def source_clone(self): ''' Clone the charts source We only support a git source type right now, which can also handle git:// local paths as well ''' subpath = self.chart.source.get('subpath', '') if 'name' not in self.chart: self._logger.exception("Please specify name for the chart") return if 'type' not in self.chart.source: self._logger.exception("Need source type for chart %s", self.chart.name) return if self.parent: self._logger.info("Cloning %s/%s as dependency for %s", self.chart.source.location, subpath, self.parent) else: self._logger.info("Cloning %s/%s for release %s", self.chart.source.location, subpath, self.chart.name) if self.chart.source.type == 'git': if 'reference' not in self.chart.source: self.chart.source.reference = 'master' if 'path' not in self.chart.source: self.chart.source.path = '' self._source_tmp_dir = repo.git_clone(self.chart.source.location, self.chart.source.reference, self.chart.source.path) elif self.chart.source.type == 'repo': if 'version' not in self.chart: self.chart.version = None if 'headers' not in self.chart.source: self.chart.source.headers = None self._source_tmp_dir = repo.from_repo(self.chart.source.location, self.chart.name, self.chart.version, self.chart.source.headers) elif self.chart.source.type == 'directory': self._source_tmp_dir = self.chart.source.location else: self._logger.exception("Unknown source type %s for chart %s", self.chart.name, self.chart.source.type) return return os.path.join(self._source_tmp_dir, subpath)
def source_clone(self): ''' Clone the charts source We only support a git source type right now, which can also handle git:// local paths as well ''' subpath = self.chart.source.get('subpath', '') if not 'type' in self.chart.source: self._logger.exception("Need source type for chart %s", self.chart.name) return if self.parent: self._logger.info("Cloning %s/%s as dependency for %s", self.chart.source.location, subpath, self.parent) else: self._logger.info("Cloning %s/%s for release %s", self.chart.source.location, subpath, self.chart.name) if self.chart.source.type == 'git': if 'reference' not in self.chart.source: self.chart.source.reference = 'master' if 'path' not in self.chart.source: self.chart.source.path = '' self._source_tmp_dir = repo.git_clone(self.chart.source.location, self.chart.source.reference, self.chart.source.path) elif self.chart.source.type == 'repo': if 'version' not in self.chart: self.chart.version = None if 'headers' not in self.chart.source: self.chart.source.headers = None self._source_tmp_dir = repo.from_repo(self.chart.source.location, self.chart.name, self.chart.version, self.chart.source.headers) elif self.chart.source.type == 'directory': self._source_tmp_dir = self.chart.source.location else: self._logger.exception("Unknown source type %s for chart %s", self.chart.name, self.chart.source.type) return return os.path.join(self._source_tmp_dir, subpath)
def source_clone(self): """ Clone the charts source We only support a git source type right now, which can also handle git:// local paths as well """ subpath = self.chart.source.get("subpath", "") if "name" not in self.chart: self._logger.exception("Please specify name for the chart") return if "type" not in self.chart.source: self._logger.exception("Need source type for chart %s", self.chart.name) return if self.parent: self._logger.info( "Cloning %s/%s as dependency for %s", self.chart.source.location, subpath, self.parent, ) else: self._logger.info( "Cloning %s/%s for release %s", self.chart.source.location, subpath, self.chart.name, ) if self.chart.source.type == "git": if "reference" not in self.chart.source: self.chart.source.reference = "master" if "path" not in self.chart.source: self.chart.source.path = "" self._source_tmp_dir = repo.git_clone( self.chart.source.location, self.chart.source.reference, self.chart.source.path, ) elif self.chart.source.type == "repo": if "version" not in self.chart: self.chart.version = None if "headers" not in self.chart.source: self.chart.source.headers = None self._source_tmp_dir = repo.from_repo( self.chart.source.location, self.chart.name, self.chart.version, self.chart.source.headers, ) elif self.chart.source.type == "directory": self._source_tmp_dir = self.chart.source.location else: self._logger.exception( "Unknown source type %s for chart %s", self.chart.name, self.chart.source.type, ) return return os.path.join(self._source_tmp_dir, subpath)
def test_git_clone(self, _0, mocked_git): r = repo.git_clone('git://test', path='foo') self.assertEquals(r, '/tmp/dir/foo')
def test_git_clone(self, _0, mocked_git): r = repo.git_clone("git://test", path="foo") self.assertEqual(r, "/tmp/dir/foo")