本文整理汇总了Python中Server.Server.from_config方法的典型用法代码示例。如果您正苦于以下问题:Python Server.from_config方法的具体用法?Python Server.from_config怎么用?Python Server.from_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Server
的用法示例。
在下文中一共展示了Server.from_config方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: server
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import from_config [as 别名]
def server(self, dist, target, upgrade_from_path=None, start=False):
if upgrade_from_path is not None:
raise Exception("***DEPRECATED*** Please use \"xl-helper upgrade server\"")
source = dist.path if isinstance(dist, LocalServerDist) else self.cache.get(dist)
ZipFile(source, 'r').extractall(target)
# Copy available plugins
server_dir = os.path.join(target, '.'.join(dist.get_filename().split('.')[:-1]))
print "Server has been installed to %s" % server_dir
for root, dirs, files in os.walk(os.path.join(server_dir, 'available-plugins')):
for file_ in files:
print "Copying available plugin %s" % file_
if file_.endswith('.jar'):
shutil.copy(os.path.join(root, file_), os.path.join(server_dir, 'plugins', file_))
proper_license = self.license_location if (dist.version == 'SNAPSHOT' or int(dist.version[0]) >= 4) else self.license_location_3x
print "Copying license from %s" % proper_license
shutil.copy(proper_license, os.path.join(server_dir, 'conf', 'deployit-license.lic'))
for dirpath, d, file_names in os.walk(target):
for filename in file_names:
if filename.endswith(".sh"):
os.chmod(dirpath + '/' + filename, 0750)
if start:
Server.from_config(config=self.config, home=server_dir).run()
return server_dir
示例2: server
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import from_config [as 别名]
def server(self, dist, target, upgrade_from_path=None, start=False):
source = dist.path if isinstance(dist, LocalServerDist) else self.cache.get(dist)
ZipFile(source, 'r').extractall(target)
# Copy available plugins
server_dir = os.path.join(target, '.'.join(dist.get_filename().split('.')[:-1]))
print "Server has been installed to %s" % server_dir
for root, dirs, files in os.walk(os.path.join(server_dir, 'available-plugins')):
for file_ in files:
print "Copying available plugin %s" % file_
if file_.endswith('.jar'):
shutil.copy(os.path.join(root, file_), os.path.join(server_dir, 'plugins', file_))
proper_license = self.license_location if (dist.version.startswith('4') or dist.version == 'SNAPSHOT') else self.license_location_3x
print "Copying license from %s" % proper_license
shutil.copy(proper_license, os.path.join(server_dir, 'conf', 'deployit-license.lic'))
for dirpath, d, file_names in os.walk(target):
for filename in file_names:
if filename.endswith(".sh"):
os.chmod(dirpath + '/' + filename, 0750)
if upgrade_from_path is not None:
print "Copying files from old installation at %s" % upgrade_from_path
if os.path.isdir(os.path.join(upgrade_from_path, 'repository')):
dir_util.copy_tree(os.path.join(upgrade_from_path, 'repository'), os.path.join(server_dir, 'repository'))
dir_util.copy_tree(os.path.join(upgrade_from_path, 'plugins'), os.path.join(server_dir, 'plugins'))
dir_util.copy_tree(os.path.join(upgrade_from_path, 'conf'), os.path.join(server_dir, 'conf'))
dir_util.copy_tree(os.path.join(upgrade_from_path, 'ext'), os.path.join(server_dir, 'ext'))
self._remove_old_plugins(server_dir)
if start:
Server.from_config(config=self.config, home=server_dir).start()
return server_dir
示例3: plugin
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import from_config [as 别名]
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()