def make_service(self): eru = self.params.get('eru') pod = self.params.get('pod') ip = self.params.get('ip') if not eru or not pod or not ip: return False return copy_to_remote( self.uploader, config.DOCKER_SETUP, ip=ip, eru=eru, pod=pod, builder=config.DOCKER_GENERATOR) and \ copy_to_remote(self.uploader, config.DOCKER_GENERATOR) and \ copy_to_remote(self.uploader, config.DOCKER_NSENTER, config.REMOTE_BIN_DIR) and \ copy_to_remote(self.uploader, config.DOCKER_ENTER, config.REMOTE_BIN_DIR)
def make_service(self): eru = self.params.get('eru') ip = self.params.get('ip') hub = self.params.get('hub') pod = self.params.get('pod', '') data = self.params.get('data', 100) meta = self.params.get('data', 20) if not eru or not ip or not hub: return False return copy_to_remote( self.uploader, config.DOCKER_SETUP, data=data, ip=ip, eru=eru, hub=hub, meta=meta, pod=pod, builder=config.DOCKER_GENERATOR) and \ copy_to_remote(self.uploader, config.DOCKER_GENERATOR) and \ copy_to_remote(self.uploader, config.DOCKER_NSENTER, config.REMOTE_BIN_DIR) and \ copy_to_remote(self.uploader, config.DOCKER_ENTER, config.REMOTE_BIN_DIR)
def upload_service(self): p = os.path.join(config.LOCAL_SERVICES_DIR, config.REGISTRY_SERVICE) with open(p) as fp: svr_unit = fp.read() svr_unit = svr_unit.format( registry_bin_path = os.path.join(config.REMOTE_BIN_DIR, config.REGISTRY_BIN), registry_config_path = os.path.join(config.REMOTE_REGISTRY_CONFIG_PATH, config.REGISTRY_CONFIG_FILE) ) rp = os.path.join(config.REMOTE_SERVICE_DIR, config.REGISTRY_SERVICE) return make_remote_file(self.uploader, rp, svr_unit) and \ copy_to_remote(self.uploader, config.REGISTRY_BIN, config.REMOTE_BIN_DIR)
def make_service(self): mfsmaster = self.params.get('mfsmaster') port = self.params.get('port') mount = self.params.get('mount') if not mfsmaster or not port or not mount: return False return copy_to_remote( self.uploader, config.MOOSEFS_CLIENT_SERVICE, config.REMOTE_SERVICE_DIR, mfsmaster=mfsmaster, port=port, mount=mount, )
def install(self, enable=False, **kwargs): self.params.update(kwargs) if not copy_to_remote(self.uploader, config.CALICOCTL, config.REMOTE_BIN_DIR): return False cmd = 'cd {bindir} && chmod +x {calicoctl}'.format( bindir=config.REMOTE_BIN_DIR, calicoctl=config.CALICOCTL ) if not self.executor(cmd): return False etcd = self.params.get('etcd') ip = self.params.get('ip') if not etcd or not ip: return False image = self.params.get('image', 'calico/node') log = self.params.get('log', '/var/log/calico') cmd = 'docker pull %s' % image cmd += ' && export ETCD_AUTHORITY=%s' % etcd cmd += ' && calicoctl node --node-image=%s --log-dir=%s --ip=%s' % (image, log, ip) return self.executor(cmd)