# -*- coding: UTF-8 -*- # Copyright 2015 Red Hat, Inc. # Part of clufter project # Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt) __author__ = "Jan Pokorný " # following 2nd chance import is to allow direct usage context (testing, etc.) try: from ....utils_xslt import xslt_is_member except ValueError: # Value? from ...utils_xslt import xslt_is_member ### ccs_propagate_cman = '''\ 60 passive 3 iba yes yes ''' ### from base64 import b64encode from hashlib import sha256 from os import getpid from time import time # following 2nd chance import is to allow direct usage context (testing, etc.) try: from ....utils import lazystring from ....utils_prog import getenv_namespaced except ValueError: # Value? from ...utils import lazystring from ...utils_prog import getenv_namespaced # yield corosync v.2/needle configuration compatible with el7 ccs2needlexml = lazystring(lambda: ('''\ %(key_message)s %(key)s ''') % dict( # NB: nothing against second parameter to b64encode, but it seems to be # slower than simple chained replacement (a la urlsafe_b64encode) key='_NOT_SECRET' + ( '--' + b64encode(sha256( str(getpid()) + '_REALLY_' + str(int(time())) ).digest()).replace('+', '-').replace('/', '_').rstrip('=') if getenv_namespaced('NOSALT', '0') in ('0', 'false') else '_' ), key_message='WARNING: secret key used by corosync for encryption/integrity' ' checking is, as a measure to prevent from dropping these' ' security features entirely, stored directly in the main' ' configuration file (totem/key), possibly readable by' ' arbitrary system-local user', ), cache=False) ### try: from .... import package_name, version from ....utils_xslt import xslt_id_friendly except ValueError: from ... import package_name, version from ...utils_xslt import xslt_id_friendly ccsflat2cibprelude_self_id = "{0} {1}".format(package_name(), version) # should roughly match the output of: # (exec 3>&1; exec >/dev/null; export CIB_shadow=test-shadow; # crm_shadow -bfe "${CIB_shadow}"; cat "$(crm_shadow -bF)">&3; # crm_shadow -bfD "${CIB_shadow}") # # # # # # # # # ccsflat2cibprelude = ('''\ FENCING/STONITH (+ POSSIBLY TOPOLOGY BELOW) RESOURCES+ARRANGEMENT ''') % dict(self_id=ccsflat2cibprelude_self_id) ### # following 2nd chance import is to allow direct usage context (testing, etc.) try: from ....utils_xslt import xslt_is_member except ValueError: # Value? from ...utils_xslt import xslt_is_member ccs_revitalize_fa_domain = tuple( 'fence_' + agent for agent in ('virt', 'xvm') ) ccs_revitalize = '''\ ''' ### ccs_version_bump = '''\ ''' ### # check http://stackoverflow.com/questions/4509662/how-to-generate-unique-string # XXX device/@port for: fence_pcmk, fence_rhevm, fence_virsh, fence_{virt,xvm}, # fence_vmware{,_soap} (?) ccs_obfuscate_identifiers = '''\ ''' ### # following 2nd chance import is to allow direct usage context (testing, etc.) try: from ....filters._2pcscmd import coro2pcscmd except ValueError: # Value? from ...filters._2pcscmd import coro2pcscmd ccspcmk2pcscmd = coro2pcscmd(cman='', node='clusternode', totem='')