def test_build_urls_for_cli(self): self.assertEqual( 'https://dist.xebialabs.com/xl-deploy/4.0.0/xl-deploy-4.0.0-cli.zip', Utils.build_url('4.0.0', 'cli')) self.assertEqual( 'https://dist.xebialabs.com/deployit/3.9.4/deployit-3.9.4-cli.zip', Utils.build_url('3.9.4', 'cli'))
def test_build_url_for_plugins(self): expected_path = 'https://dist.xebialabs.com/plugins/tomcat-plugin/3.9.2/tomcat-plugin-3.9.2.jar' assert expected_path == Utils.build_url('3.9.2', 'plugin', 'tomcat') expected_path = 'https://dist.xebialabs.com/plugins/ec2-plugin/4.0.0-beta-3/ec2-plugin-4.0.0-beta-3.jar' assert expected_path == Utils.build_url('4.0.0-beta-3', 'plugin', 'ec2') expected_path = 'https://dist.xebialabs.com/plugins/xl-scale-plugin/4.0.0/xl-scale-plugin-4.0.0.jar' assert expected_path == Utils.build_url('4.0.0', 'plugin', 'xl-scale')
def _get_url(self): if self.version == 'SNAPSHOT': job = self._jenkins.get_job(self._jobName) artifacts = job.get_last_good_build().get_artifact_dict().values() server_artifact = [a for a in artifacts if a.filename.endswith('-server.zip')].pop() return server_artifact.url else: return Utils.build_url(_version=self.version, _xltype="server")
def download(self, target): print "Downloading CLI distribution %s" % self.version Utils().download( url=Utils.build_url(_version=self.version, _xltype="cli"), target=target, username=self._downloadsUsername, password=self._downloadsPassword ) return self
def plugin(self, name, version, server_location): plugins_path = os.path.join(server_location, 'plugins') print "Installing plugin %s into " % plugins_path u = Utils.build_url(_version=version, _xltype="plugin", _plugin_short_name=name) Utils().download( url=u, target=plugins_path, username=self.config.get('downloads', 'username'), password=self.config.get('downloads', 'password') ) server = Server.from_config(config=self.config, home=server_location) if server.is_running(): server.restart()
def plugin(self, name, version, server_location): plugins_path = os.path.join(server_location, 'plugins') print "Installing plugin %s into " % plugins_path u = Utils.build_url(_version=version, _xltype="plugin", _plugin_short_name=name) Utils().download(url=u, target=plugins_path, username=self.config.get('downloads', 'username'), password=self.config.get('downloads', 'password')) server = Server.from_config(config=self.config, home=server_location) if server.is_running(): server.restart()
def test_download_plugin(self): tomcat_url = Utils.build_url('4.0.0-beta-3', 'plugin', 'ec2') target_file = Utils.download(tomcat_url, os.getcwd(), self.downloads_username, self.downloads_password) os.remove(target_file)
def test_build_url_for_servers(self): expected_path = 'https://dist.xebialabs.com/xl-deploy/4.0.0/xl-deploy-4.0.0-server.zip' assert expected_path == Utils.build_url('4.0.0', 'server') expected_path = 'https://dist.xebialabs.com/deployit/3.9.4/deployit-3.9.4-server.zip' assert expected_path == Utils.build_url('3.9.4', 'server')