def get_server_dir(self): """ Either downloads and/or unzips the server if necessary return: the directory of the unzipped server """ if not self.args.server: if self.args.skipunzip: raise Stop(0, "Unzip disabled, exiting") log.info("Downloading server") artifacts = Artifacts(self.args) server = artifacts.download("server") else: progress = 0 if self.args.verbose: progress = 20 ptype, server = fileutils.get_as_local_path( self.args.server, self.args.overwrite, progress=progress, httpuser=self.args.httpuser, httppassword=self.args.httppassword, ) if ptype == "file": if self.args.skipunzip: raise Stop(0, "Unzip disabled, exiting") log.info("Unzipping %s", server) server = fileutils.unzip(server, match_dir=True, destdir=self.args.unzipdir) log.debug("Server directory: %s", server) return server
def get_server_dir(self): """ Either downloads and/or unzips the server if necessary return: the directory of the unzipped server """ if not self.args.server: if self.args.skipunzip: raise Stop(0, 'Unzip disabled, exiting') log.info('Downloading server') artifacts = Artifacts(self.args) server = artifacts.download('server') else: progress = 0 if self.args.verbose: progress = 20 ptype, server = fileutils.get_as_local_path( self.args.server, self.args.overwrite, progress=progress, httpuser=self.args.httpuser, httppassword=self.args.httppassword) if ptype == 'file': if self.args.skipunzip: raise Stop(0, 'Unzip disabled, exiting') log.info('Unzipping %s', server) server = fileutils.unzip(server, match_dir=True, destdir=self.args.unzipdir) log.debug('Server directory: %s', server) return server
def download(self, component): componenturl = self.artifacts.get(component) if not componenturl: raise Exception("No %s found" % component) filename = os.path.basename(componenturl) unzipped = filename.replace(".zip", "") if os.path.exists(unzipped): self.create_symlink(unzipped) return unzipped log.info("Checking %s", componenturl) if self.args.dry_run: return progress = 0 if self.args.verbose: progress = 20 ptype, localpath = fileutils.get_as_local_path( componenturl, self.args.overwrite, progress=progress, httpuser=self.args.httpuser, httppassword=self.args.httppassword) if ptype != 'file': raise ArtifactException('Expected local file', localpath) if not self.args.skipunzip: if localpath.endswith('.zip'): try: log.info('Unzipping %s', localpath) unzipped = fileutils.unzip(localpath, match_dir=True, destdir=self.args.unzipdir) self.create_symlink(unzipped) return unzipped except Exception as e: log.error('Unzip failed: %s', e) print e raise Stop(20, 'Unzip failed, try unzipping manually') else: log.warn('Not unzipping %s', localpath) return localpath
def download(self, component): componenturl = self.artifacts.get(component) if not componenturl: raise Exception("No %s found" % component) filename = os.path.basename(componenturl) unzipped = filename.replace(".zip", "") if os.path.exists(unzipped): self.create_symlink(unzipped) return unzipped log.info("Checking %s", componenturl) if self.args.dry_run: return progress = 0 if self.args.verbose: progress = 20 ptype, localpath = fileutils.get_as_local_path( componenturl, self.args.overwrite, progress=progress, httpuser=self.args.httpuser, httppassword=self.args.httppassword) if ptype != 'file': raise ArtifactException('Expected local file', localpath) if not self.args.skipunzip: if localpath.endswith('.zip'): try: log.info('Unzipping %s', localpath) unzipped = fileutils.unzip( localpath, match_dir=True, destdir=self.args.unzipdir) self.create_symlink(unzipped) return unzipped except Exception as e: log.error('Unzip failed: %s', e) print e raise Stop(20, 'Unzip failed, try unzipping manually') else: log.warn('Not unzipping %s', localpath) return localpath
def get_server_dir(self): """ Either downloads and/or unzips the server if necessary return: the directory of the unzipped server """ if not self.args.server: if self.args.skipunzip: raise Stop(0, 'Unzip disabled, exiting') log.info('Downloading server') # The downloader automatically symlinks the server, however if # we are upgrading we want to delay the symlink swap, so this # overrides args.sym # TODO: Find a nicer way to do this? artifact_args = copy.copy(self.args) artifact_args.sym = '' artifacts = Artifacts(artifact_args) server = artifacts.download('server') else: progress = 0 if self.args.verbose: progress = 20 ptype, server = fileutils.get_as_local_path( self.args.server, self.args.overwrite, progress=progress, httpuser=self.args.httpuser, httppassword=self.args.httppassword) if ptype == 'file': if self.args.skipunzip: raise Stop(0, 'Unzip disabled, exiting') log.info('Unzipping %s', server) server = fileutils.unzip(server, match_dir=True, destdir=self.args.unzipdir) log.debug('Server directory: %s', server) return server
def get_server_dir(self): """ Either downloads and/or unzips the server if necessary return: the directory of the unzipped server """ if not self.args.server: if self.args.skipunzip: raise Stop(0, 'Unzip disabled, exiting') log.info('Downloading server') # The downloader automatically symlinks the server, however if # we are upgrading we want to delay the symlink swap, so this # overrides args.sym # TODO: Find a nicer way to do this? artifact_args = copy.copy(self.args) artifact_args.sym = '' artifacts = Artifacts(artifact_args) server = artifacts.download('server') else: progress = 0 if self.args.verbose: progress = 20 ptype, server = fileutils.get_as_local_path( self.args.server, self.args.overwrite, progress=progress, httpuser=self.args.httpuser, httppassword=self.args.httppassword) if ptype == 'file': if self.args.skipunzip: raise Stop(0, 'Unzip disabled, exiting') log.info('Unzipping %s', server) server = fileutils.unzip( server, match_dir=True, destdir=self.args.unzipdir) log.debug('Server directory: %s', server) return server