def __init__(self, langBund, framework): self.bundles = [ langBund, shellutils.getLanguageBundle('langNetwork', shellutils.DEFAULT_LANGUAGE, framework) ] self.bundle = None
def detectLangBandle(self, framework): clusterNameKeyword = self.__bundle.getString('cluster_name_keyword') output = self.__exec('/VER', clusterNameKeyword) if not re.search(clusterNameKeyword, output): fallback_lang = shellutils.LANG_ENGLISH fallback_bundle = shellutils.getLanguageBundle('langMsCluster', fallback_lang, framework) fall_back_keyword = fallback_bundle.getString('cluster_name_keyword') output = self.__exec('/VER', fall_back_keyword) if re.search(fall_back_keyword, output): return fallback_bundle else: raise ValueError('Failed to decode cluster name. No discovery possible') return self.__bundle
def DiscoveryMain(Framework): vector = ObjectStateHolderVector() codePage = Framework.getCodePage() props = Properties() props.setProperty(BaseAgent.ENCODING, codePage) shell = None try: client = Framework.createClient(props) shell = shellutils.ShellFactory().createShell(client) dnsResolver = dns_resolver.NsLookupDnsResolver(shell) language = shell.osLanguage logger.debug("Using '%s' language bundle" % language.bundlePostfix) bundle = shellutils.getLanguageBundle('langMsCluster', language, Framework) clusterCmd = ms_cluster_discoverer.createClusterCmd(shell, bundle) if clusterCmd.isUsingCmd(): bundle = clusterCmd.detectLangBandle(Framework) clusterCmd.setBundle(bundle) vector.addAll(_discoverTopology(clusterCmd, bundle, dnsResolver)) except NoInstanceFound: errobj = errorobject.createError( errorcodes.MS_CLUSTER_INSTANCES_NOT_FOUND, None, 'MS cluster instances not found in discovery') logger.reportWarningObject(errobj) except: msg = str(sys.exc_info()[1]) logger.debugException(msg) if (msg.lower().find('timeout') > -1): errobj = errorobject.createError( errorcodes.CONNECTION_TIMEOUT_NO_PROTOCOL, None, 'Connection timed out - reactivate with larger timeout value') logger.reportErrorObject(errobj) logger.debugException('Connection timed out') else: errobj = errormessages.resolveError(msg, 'ntcmd') logger.reportErrorObject(errobj) logger.errorException(msg) try: shell and shell.closeClient() except: logger.debugException() logger.error("Unable to close shell") return vector
def detectLangBandle(self, framework): clusterNameKeyword = self.__bundle.getString('cluster_name_keyword') output = self.__exec('/VER', clusterNameKeyword) if not re.search(clusterNameKeyword, output): fallback_lang = shellutils.LANG_ENGLISH fallback_bundle = shellutils.getLanguageBundle( 'langMsCluster', fallback_lang, framework) fall_back_keyword = fallback_bundle.getString( 'cluster_name_keyword') output = self.__exec('/VER', fall_back_keyword) if re.search(fall_back_keyword, output): return fallback_bundle else: raise ValueError( 'Failed to decode cluster name. No discovery possible') return self.__bundle
def __init__(self, langBund, framework): self.bundles = [langBund, shellutils.getLanguageBundle("langNetwork", shellutils.DEFAULT_LANGUAGE, framework)] self.bundle = None