IConstWUClusterInfo *ensureClusterInfo() { clusterInfo.setown(getTargetClusterInfo(target)); if (!clusterInfo) throw MakeStringException(PKG_TARGET_NOT_DEFINED, "Could not find information about target cluster %s ", target.str()); return clusterInfo; }
void cloneFileInfoToDali(StringArray ¬Found, IPropertyTree *packageMap, const char *lookupDaliIp, const char *dstCluster, const char *srcCluster, const char *prefix, bool overWrite, IUserDescriptor* userdesc, bool allowForeignFiles) { Owned<IConstWUClusterInfo> clusterInfo = getTargetClusterInfo(dstCluster); if (!clusterInfo) throw MakeStringException(PKG_TARGET_NOT_DEFINED, "Could not find information about target cluster %s ", dstCluster); cloneFileInfoToDali(notFound, packageMap, lookupDaliIp, clusterInfo, srcCluster, prefix, overWrite, userdesc, allowForeignFiles); }
bool isFileKnownOnCluster(const char *logicalname, const char *target, IUserDescriptor* userdesc) { Owned<IConstWUClusterInfo> clusterInfo = getTargetClusterInfo(target); if (!clusterInfo) throw MakeStringException(PKG_TARGET_NOT_DEFINED, "Could not find information about target cluster %s ", target); return isFileKnownOnCluster(logicalname, clusterInfo, userdesc); }
void updateUsers() { Owned<IStringIterator> clusters = getTargetClusters("RoxieCluster", NULL); ForEach(*clusters) { SCMStringBuffer target; clusters->str(target); Owned<IConstWUClusterInfo> info = getTargetClusterInfo(target.str()); Owned<IUserDescriptor> user = createUserDescriptor(); user->set(info->getLdapUser(), info->getLdapPassword()); roxieUserMap.setValue(target.str(), user); roxieUsers.append(*user.getClear()); } }
void addPackageMapInfo(const char *xml, StringArray &filesNotFound, const char *process, const char *target, const char *pmid, const char *packageSetName, const char *lookupDaliIp, const char *srcCluster, const char *prefix, bool activate, bool overWrite, IUserDescriptor* userdesc, bool allowForeignFiles, bool preloadAll) { if (!xml || !*xml) throw MakeStringExceptionDirect(PKG_INFO_NOT_DEFINED, "PackageMap info not provided"); if (srcCluster && *srcCluster) { if (!isProcessCluster(lookupDaliIp, srcCluster)) throw MakeStringException(PKG_INVALID_CLUSTER_TYPE, "Process cluster %s not found on %s DALI", srcCluster, lookupDaliIp ? lookupDaliIp : "local"); } Owned<IConstWUClusterInfo> clusterInfo = getTargetClusterInfo(target); if (!clusterInfo) throw MakeStringException(PKG_TARGET_NOT_DEFINED, "Could not find information about target cluster %s ", target); Owned<IPropertyTree> pmTree = createPTreeFromXMLString(xml); if (!pmTree) throw MakeStringExceptionDirect(PKG_INFO_NOT_DEFINED, "Invalid PackageMap info"); StringBuffer lcPmid(pmid); pmid = lcPmid.toLowerCase().str(); pmTree->setProp("@id", pmid); Owned<IPropertyTreeIterator> iter = pmTree->getElements("Package"); ForEach(*iter) { IPropertyTree &item = iter->query(); if (preloadAll) item.setPropBool("@preload", true); Owned<IPropertyTreeIterator> superFiles = item.getElements("SuperFile"); ForEach(*superFiles) { IPropertyTree &superFile = superFiles->query(); StringBuffer lc(superFile.queryProp("@id")); const char *id = lc.toLowerCase().str(); if (*id == '~') id++; superFile.setProp("@id", id); Owned<IPropertyTreeIterator> subFiles = superFile.getElements("SubFile"); ForEach(*subFiles) { IPropertyTree &subFile = subFiles->query(); id = subFile.queryProp("@value"); if (id && *id == '~') { StringAttr value(id+1); subFile.setProp("@value", value.get()); } } } } VStringBuffer xpath("PackageMap[@id='%s']", pmid); Owned<IRemoteConnection> globalLock = querySDS().connect("/PackageMaps", myProcessSession(), RTM_LOCK_WRITE|RTM_CREATE_QUERY, SDS_LOCK_TIMEOUT); IPropertyTree *packageMaps = globalLock->queryRoot(); IPropertyTree *pmExisting = packageMaps->queryPropTree(xpath); xpath.appendf("[@querySet='%s']", target); Owned<IPropertyTree> pkgSet = getPkgSetRegistry(process, false); IPropertyTree *psEntry = pkgSet->queryPropTree(xpath); if (!overWrite && (psEntry || pmExisting)) throw MakeStringException(PKG_NAME_EXISTS, "Package name %s already exists, either delete it or specify overwrite", pmid); cloneFileInfoToDali(filesNotFound, pmTree, lookupDaliIp, clusterInfo, srcCluster, prefix, overWrite, userdesc, allowForeignFiles); if (pmExisting) packageMaps->removeTree(pmExisting); packageMaps->addPropTree("PackageMap", pmTree.getClear()); if (!psEntry) { psEntry = pkgSet->addPropTree("PackageMap", createPTree("PackageMap")); psEntry->setProp("@id", pmid); psEntry->setProp("@querySet", target); } makePackageActive(pkgSet, psEntry, target, activate); }