def get_service_manifest(self, service): tmp = MGeneral.get_service_manifest(self, service) self.set_persistent(service.sid) log('Calling get_service_snapshot') snapshot = callmanager(service.sid, 'get_service_snapshot', True, {}) if 'StartupInstances' not in tmp: tmp['StartupInstances'] = {} tmp['StartupInstances']['resume'] = {} tmp['StartupInstances']['resume']['nodes'] = [] for node in snapshot['nodes']: node_filename = self.__get_node_archive_filename(node) data = base64.b64decode(node.pop('data')) open(node_filename, 'wb').write(data) log('%s created' % node_filename) node['archive'] = '%s/download_data/%s' % (get_director_url(), basename(node_filename)) tmp['StartupInstances']['resume']['nodes'].append(node) tmp['StartupInstances']['resume']['manager'] = snapshot['manager'] return tmp
def get_archive(self, service_id): res = callmanager(service_id, 'list_code_versions', False, {}) if 'error' in res: return '' version = '' filename = '' for row in res['codeVersions']: if 'current' in row: version = row['codeVersionId'] filename = row['filename'] break if version == '' or filename == '': return '' params = { 'codeVersionId': version } res = callmanager(service_id, "download_code_version", False, params) if 'error' in res: return '' _, temp_path = mkstemp(suffix=filename, dir=get_userdata_dir()) open(temp_path, 'w').write(res) return '%s/download_data/%s' % (get_director_url(), basename(temp_path))
def get_service_manifest(self, service): tmp = MGeneral.get_service_manifest(self, service) self.set_persistent(service.sid) log('Calling get_service_snapshot') snapshot = callmanager(service.sid, 'get_service_snapshot', True, {}) if 'StartupInstances' not in tmp: tmp['StartupInstances'] = {} tmp['StartupInstances']['resume'] = [] for node in snapshot: node_filename = self.__get_node_archive_filename(node) data = base64.b64decode(node.pop('data')) open(node_filename, 'wb').write(data) log('%s created' % node_filename) node['archive'] = '%s/download_data/%s' % (get_director_url(), basename(node_filename)) tmp['StartupInstances']['resume'].append(node) return tmp
def get_archive(self, service_id): res = callmanager(service_id, 'list_code_versions', False, {}) if 'error' in res: return '' version = '' filename = '' for row in res['codeVersions']: if 'current' in row: version = row['codeVersionId'] filename = row['filename'] break if version == '' or filename == '': return '' params = {'codeVersionId': version} res = callmanager(service_id, "download_code_version", False, params) if 'error' in res: return '' _, temp_path = mkstemp(suffix=filename, dir=get_userdata_dir()) open(temp_path, 'w').write(res) return '%s/download_data/%s' % (get_director_url(), basename(temp_path))
def save_dump(self, service_id): res = callmanager(service_id, 'sqldump', False, {}) if type(res) is dict and 'error' in res: log('Error getting SQL dump: %s' % res['error']) return '' _, temp_path = mkstemp(dir=get_userdata_dir()) open(temp_path, 'w').write(res) return '%s/download_data/%s' % (get_director_url(), basename(temp_path))
def get_startup_script(sid): script = create_startup_script(sid) if not script: return '' _, temp_path = mkstemp(prefix='startup', dir=get_userdata_dir()) open(temp_path, 'w').write(script) return '%s/download_data/%s' % (get_director_url(), basename(temp_path))