Exemplo n.º 1
0
	def uploadToHost(self, host):
		if not self.isEnabled():
			return
		if host.clusterState() == ClusterState.NODE:
			return
		dst = self.getPath()
		url = self.getDownloadUrl()
		if url:
			fileutil.mkdir(host, os.path.dirname(dst))
			host.execute("curl -o %(filename)s -sfSR -z %(filename)s %(url)s" % {"url": util.escape(url), "filename": util.escape(dst)})
Exemplo n.º 2
0
	def startControlMaster(self):
		if fileutil.existsSocket(util.localhost, self._sshControlPath()): 
			try:
				util.localhost.execute("netstat -l | fgrep %s" % self._sshControlPath())
			except:
				#remove defunct socket
				fileutil.delete(util.localhost, self._sshControlPath())
		if not fileutil.existsSocket(util.localhost, self._sshControlPath()):
			fileutil.mkdir(util.localhost, config.LOCAL_TMP_DIR + "/ssh/")
			import subprocess
			subprocess.Popen(self._sshCommand(True) + ["root@%s" % self.name], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
Exemplo n.º 3
0
	def folderExists(self):
		if not fileutil.existsDir(self, config.REMOTE_DIR):
			fileutil.mkdir(self, config.REMOTE_DIR)
		assert fileutil.existsDir(self, config.REMOTE_DIR)