Exemple #1
0
	def Execute(self, msg):
		version_list = Dl_Bukkit.get_cb_versions(msg.channel)
		simple_ver = []
		for item in version_list:
			simple_ver.append(FolderApi.convert_ver_to_float(item[0],rough = True))
		matches = list(set(simple_ver).intersection(set(msg.PVI)))
		msg.cb_version = FolderApi.expand_float_to_ver(max(matches))
		for item in version_list:
			if not item[0].find(msg.cb_version) == -1:
				version = item
				module_logger.debug('Found version match: %s'%version[0])
				break
			else:
				module_logger.debug('Version mismatch: %s - %s'%(item[0], msg.cb_version))
		match = FolderApi.check_for_existing('jars/', version[0].replace('.',''), version[1]['checksum_md5'])
		if match:
			msg.craftbukkit = package.Craftbukkit(str(version[0]), match, str(version[1]['checksum_md5']), str(version[1]['url']))
			module_logger.debug('File match found: %s - NOT DOWNLOADING'%match)
			msg.download = False
		else:
			msg.craftbukkit = package.Craftbukkit(str(version[0]), None, str(version[1]['checksum_md5']), str(version[1]['url']))
			module_logger.debug('File match FAILED - DOWNLOADING')
			msg.download = True
		delattr(msg,'PVI')
		return msg
Exemple #2
0
 def Execute(self, msg):
     version_list = Dl_Bukkit.get_cb_versions(msg.channel)
     simple_ver = []
     for item in version_list:
         simple_ver.append(
             FolderApi.convert_ver_to_float(item[0], rough=True))
     matches = list(set(simple_ver).intersection(set(msg.PVI)))
     msg.cb_version = FolderApi.expand_float_to_ver(max(matches))
     for item in version_list:
         if not item[0].find(msg.cb_version) == -1:
             version = item
             module_logger.debug('Found version match: %s' % version[0])
             break
         else:
             module_logger.debug('Version mismatch: %s - %s' %
                                 (item[0], msg.cb_version))
     match = FolderApi.check_for_existing('jars/',
                                          version[0].replace('.', ''),
                                          version[1]['checksum_md5'])
     if match:
         msg.craftbukkit = package.Craftbukkit(
             str(version[0]), match, str(version[1]['checksum_md5']),
             str(version[1]['url']))
         module_logger.debug('File match found: %s - NOT DOWNLOADING' %
                             match)
         msg.download = False
     else:
         msg.craftbukkit = package.Craftbukkit(
             str(version[0]), None, str(version[1]['checksum_md5']),
             str(version[1]['url']))
         module_logger.debug('File match FAILED - DOWNLOADING')
         msg.download = True
     delattr(msg, 'PVI')
     return msg
Exemple #3
0
	def Execute(self, msg):
		if msg.download:
			url = 'http://dl.bukkit.org' + msg.craftbukkit.url
			filename = 'jars/craftbukkit-%s.jar'%msg.craftbukkit.version.replace('.','')
			module_logger.debug('Downloading %s to %s'%(url, filename))
			FolderApi.dl_file(url, filename, self.callback)
			if FolderApi.check_md5(filename, msg.craftbukkit.md5):
				msg.craftbukkit.path = filename
		delattr(msg, 'download')
		return msg
Exemple #4
0
 def Execute(self, msg):
     if msg.download:
         url = 'http://dl.bukkit.org' + msg.craftbukkit.url
         filename = 'jars/craftbukkit-%s.jar' % msg.craftbukkit.version.replace(
             '.', '')
         module_logger.debug('Downloading %s to %s' % (url, filename))
         FolderApi.dl_file(url, filename, self.callback)
         if FolderApi.check_md5(filename, msg.craftbukkit.md5):
             msg.craftbukkit.path = filename
     delattr(msg, 'download')
     return msg
Exemple #5
0
	def Execute(self, msg):
		if FolderApi.check_md5('servers/%s/craftbukkit.jar'%msg.name, msg.package.craftbukkit.md5):
			passed = True
			for name, plugin in msg.package.plugins.iteritems():
				if not FolderApi.check_md5('servers/%s/plugins/%s.jar'%(msg.name, name), plugin.md5):
					passed = False
			if passed:
				return msg
			else:
				msg.StopProcessing = True
				msg.error = 'FileCheck -FAILED-'
				return msg
Exemple #6
0
 def Execute(self, msg):
     module_logger.debug('Executing Plugin Vesion Index Process Filter')
     module_logger.debug('Creating version lists for comparison')
     lists = []
     for plugin, index in msg.PVI.iteritems():
         vers = []
         for item in index:
             vers.extend(item[1])
         lists.append(vers)
     module_logger.debug('Comparing lists')
     x = lists.pop()
     matches = set(x)
     for item in lists:
         matches = matches.intersection(item)
     matches = list(matches)
     module_logger.debug('Converting to float representation')
     versions = []
     for version in matches:
         versions.append(FolderApi.convert_ver_to_float(version,
                                                        rough=True))
     #version = max(versions)
     #version = FolderApi.expand_float_to_ver(version)
     #module_logger.debug('Found Version: %s'%version)
     msg.pkg_version = msg.cb_version
     #msg.cb_version = version
     #print versions
     msg.PVI = versions
     return msg
Exemple #7
0
	def Execute(self, msg):
		module_logger.debug('Executing Plugin Vesion Index Process Filter')
		module_logger.debug('Creating version lists for comparison')
		lists = []
		for plugin, index in msg.PVI.iteritems():
			vers = []
			for item in index:
				vers.extend(item[1])
			lists.append(vers)
		module_logger.debug('Comparing lists')
		x = lists.pop()
		matches = set(x)
		for item in lists:
			matches = matches.intersection(item)
		matches = list(matches)
		module_logger.debug('Converting to float representation')
		versions = []
		for version in matches:
			versions.append(FolderApi.convert_ver_to_float(version, rough=True))
		#version = max(versions)
		#version = FolderApi.expand_float_to_ver(version)
		#module_logger.debug('Found Version: %s'%version)
		msg.pkg_version = msg.cb_version
		#msg.cb_version = version	
		#print versions
		msg.PVI = versions
		return msg
Exemple #8
0
	def UpdateExistingDeploy(server):
		if not FolderApi.check_md5('servers/%s/craftbukkit.jar'%server.name, server.package.craftbukkit.md5):
			module_logger.debug('Craftbukkit check -FAILED- Copying: %s'%server.package.craftbukkit.path)
			try:
				os.remove('servers/%s/craftbukkit.jar'%server.name)
			except OSError:
				pass
			shutil.copyfile(server.package.craftbukkit.path, 'servers/%s/craftbukkit.jar'%server.name)
		for name, plugin in server.package.plugins.iteritems():
			if not FolderApi.check_md5('servers/%s/plugins/%s.jar'%(server.name, name), plugin.md5):
				module_logger.debug('Check: %s -FAILED- Copying: %s'%(name, plugin.path))
				try:
					os.remove('servers/%s/plugins/%s.jar'%(server.name, name))
				except OSError:
					pass
				shutil.copyfile(plugin.path, 'servers/%s/plugins/%s.jar'%(server.name, name))
Exemple #9
0
	def Execute(self, msg):
		module_logger.debug('Downloading Plugins')
		for plugin in msg.plugins:
			file = plugin+str(FolderApi.convert_ver_to_float(msg.craftbukkit.version, whole=True))
			deets = Dev_Bukkit.find_compat(plugin, msg.cb_version)
			module_logger.debug('Checking for Existing: %s'%plugin)
			existing = FolderApi.check_for_existing('jars/', file, deets[1])
			module_logger.debug('Check Returned: %s' %str(existing))
			if not existing == False:
				module_logger.debug('Match Found: %s'%existing)
				msg.plugins[plugin] = package.Plugin(existing, plugin, deets[1])
			else:
				module_logger.debug('Downloading: %s'%plugin)
				filename = 'jars/%s.jar'%(file)
				FolderApi.dl_file(deets[0], filename, self.callback)
				if FolderApi.check_md5(filename, deets[1]):
					msg.plugins[plugin] = package.Plugin(filename, plugin, deets[1])
					module_logger.debug('Finished downloading %s'%plugin)
		return msg
			
Exemple #10
0
	def Execute(self, msg):
		pkg = msg.package
		module_logger.debug('Checking Craftbukkit')
		if FolderApi.check_md5(pkg.craftbukkit.path, pkg.craftbukkit.md5):
			module_logger.debug('Craftbukkit Check PASSED - Checking Plugins')
			passed = True
			for name, plugin in pkg.plugins.iteritems():
				module_logger.debug('Checking %s'%name)
				if not FolderApi.check_md5(plugin.path, plugin.md5):
					module_logger.debug('%s Hash Check FAILED'%name)
					passed = False
					msg.error = 'PkgVerify -FAILED- %s Check Failed'%name
				else:
					module_logger.debug('%s Hash Check PASSED'%name)
			if not passed:
				msg.StopProcessing = True
		else:
			module_logger.debug('CraftBukkit Check FAILED')
			msg.StopProcessing = True
			msg.error = 'PkgVerify -FAILED- Craftbukkit Check Failed'
		return msg
Exemple #11
0
 def Execute(self, msg):
     module_logger.debug('Downloading Plugins')
     for plugin in msg.plugins:
         file = plugin + str(
             FolderApi.convert_ver_to_float(msg.craftbukkit.version,
                                            whole=True))
         deets = Dev_Bukkit.find_compat(plugin, msg.cb_version)
         module_logger.debug('Checking for Existing: %s' % plugin)
         existing = FolderApi.check_for_existing('jars/', file, deets[1])
         module_logger.debug('Check Returned: %s' % str(existing))
         if not existing == False:
             module_logger.debug('Match Found: %s' % existing)
             msg.plugins[plugin] = package.Plugin(existing, plugin,
                                                  deets[1])
         else:
             module_logger.debug('Downloading: %s' % plugin)
             filename = 'jars/%s.jar' % (file)
             FolderApi.dl_file(deets[0], filename, self.callback)
             if FolderApi.check_md5(filename, deets[1]):
                 msg.plugins[plugin] = package.Plugin(
                     filename, plugin, deets[1])
                 module_logger.debug('Finished downloading %s' % plugin)
     return msg
Exemple #12
0
	def DeployConfig(server):
		files = path.path('config/%s/'%server.config).walkfiles()
		header = len(str(path.path('config/%s/'%server.config)))
		configfiles = {}
		for file in files:
			md5 = DeployApi.gen_md5(str(file))
			key = file[header:]
			configfiles[key] = md5
			
		for file, md5 in configfiles.iteritems():
			if not FolderApi.check_md5('servers/%s/%s'%(server.name, file), md5):
				try:
					os.remove('servers/%s/%s'%(server.name, file))
				except OSError:
					pass
				try:
					shutil.copyfile('config/%s/%s'%(server.config, file), 'servers/%s/%s'%(server.name, file))
				except IOError:
					folder = file[:file.rfind('/')]
					folder = 'servers/%s/%s'%(server.name,folder)
					os.makedirs(folder)
					shutil.copyfile('config/%s/%s'%(server.config, file), 'servers/%s/%s'%(server.name, file))