def _test_download(self, remote_file, command, message): files.remove(TestXrootd.download_temp) try: core.check_system(command, message, user=True) self.assert_(os.path.isfile(TestXrootd.download_temp), "Downloaded file missing") self.assertEqualVerbose( files.read(TestXrootd.download_temp, as_single_string=True), files.read(remote_file, as_single_string=True), "Downloaded contents differ from expected") finally: files.remove(TestXrootd.download_temp)
def test_03_modify_sudoers(self): if core.missing_rpm('bestman2-server', 'bestman2-client', 'voms-clients'): core.skip('Bestman not installed') return sudoers_path = '/etc/sudoers' contents = files.read(sudoers_path) srm_cmd = 'Cmnd_Alias SRM_CMD = /bin/rm, /bin/mkdir, /bin/rmdir, /bin/mv, /bin/cp, /bin/ls' srm_usr = '******' bestman_perm = 'bestman ALL=(SRM_USR) NOPASSWD: SRM_CMD' require_tty = 'Defaults requiretty' had_srm_cmd_line = False had_requiretty_commented = False for line in contents: if require_tty in line: if line.startswith("#"): had_requiretty_commented = True if srm_cmd in line: had_srm_cmd_line = True new_contents = [] for line in contents: if not had_requiretty_commented: if line.strip() == require_tty.strip(): new_contents += '#' + line + '\n' else: new_contents += line.strip() + '\n' if not had_srm_cmd_line: new_contents += srm_cmd + '\n' new_contents += srm_usr + '\n' new_contents += bestman_perm + '\n' if not had_srm_cmd_line or not had_requiretty_commented: files.write(sudoers_path, new_contents, owner='bestman')
def test_02_scitoken_mapping(self): core.state['condor-ce.wrote-mapfile'] = False core.skip_ok_unless_installed('condor', 'htcondor-ce') self.skip_ok_if( core.PackageVersion('condor') <= '8.9.4', 'HTCondor version does not support SciToken submission') condorce_version = core.PackageVersion('htcondor-ce') scitoken_mapping = 'SCITOKENS {issuer} {local_user}\n' # Write the mapfile to the admin mapfile directory with the regex format for the issuer # required by 'CERTIFICATE_MAPFILE_ASSUME_HASH_KEYS = True' # https://github.com/htcondor/htcondor-ce/pull/425 if condorce_version >= '5.1.0': match_str = r'/https:\/\/demo.scitokens.org,.*/' core.config[ 'condor-ce.mapfile'] = '/etc/condor-ce/mapfiles.d/01-osg-test.conf' else: match_str = '"https://demo.scitokens.org"' core.config['condor-ce.mapfile'] = '/etc/condor-ce/condor_mapfile' mapfile_contents = files.read(core.config['condor-ce.mapfile'], as_single_string=True) scitoken_mapping += mapfile_contents files.write(core.config['condor-ce.mapfile'], scitoken_mapping.format(issuer=match_str, local_user=core.options.username), owner='condor-ce', chmod=0o644) core.state['condor-ce.wrote-mapfile'] = True
def test_04_modify_bestman_conf(self): core.skip_ok_unless_installed('bestman2-server', 'bestman2-client', 'gums-service') bestman_rc_path = '/etc/bestman2/conf/bestman2.rc' old_port = 'securePort=8443' new_port = 'securePort=10443' files.replace(bestman_rc_path, old_port, new_port, backup=False) old_gridmap = 'GridMapFileName=/etc/bestman2/conf/grid-mapfile.empty' new_gridmap = 'GridMapFileName=/etc/grid-security/grid-mapfile' files.replace(bestman_rc_path, old_gridmap, new_gridmap, backup=False) files.replace(bestman_rc_path, 'eventLogLevel=INFO', 'eventLogLevel=DEBUG', backup=False) core.system(('cat', bestman_rc_path)) env_file = '/etc/sysconfig/bestman2' old_auth = 'BESTMAN_GUMS_ENABLED=yes' new_auth = 'BESTMAN_GUMS_ENABLED=no' files.replace(env_file, old_auth, new_auth, backup=False) log4j_path = '/etc/bestman2/properties/log4j.properties' log4j_contents = files.read(log4j_path, as_single_string=True) log4j_contents = log4j_contents.replace('FATAL', 'INFO') files.write(log4j_path, log4j_contents, backup=False)
def test_03_modify_sudoers(self): core.skip_ok_unless_installed('bestman2-server', 'bestman2-client') sudoers_path = '/etc/sudoers' contents = files.read(sudoers_path) srm_cmd = 'Cmnd_Alias SRM_CMD = /bin/rm, /bin/mkdir, /bin/rmdir, /bin/mv, /bin/cp, /bin/ls' srm_usr = '******' bestman_perm = 'bestman ALL=(SRM_USR) NOPASSWD: SRM_CMD' require_tty = 'Defaults requiretty' had_srm_cmd_line = False had_requiretty_commented = False for line in contents: if require_tty in line: if line.startswith("#"): had_requiretty_commented = True if srm_cmd in line: had_srm_cmd_line = True new_contents = [] for line in contents: if not had_requiretty_commented: if line.strip() == require_tty.strip(): new_contents += '#'+line+'\n' else: new_contents += line.strip()+'\n' if not had_srm_cmd_line: new_contents += srm_cmd+'\n' new_contents += srm_usr+'\n' new_contents += bestman_perm+'\n' if not had_srm_cmd_line or not had_requiretty_commented: files.write(sudoers_path, new_contents, owner='bestman')
def assertCached(self, name, contents): fpath = os.path.join(_getcfg("cache_dir"), name) self.assertTrue(os.path.exists(fpath), name + " not cached") self.assertEqualVerbose(actual=files.read(fpath, as_single_string=True), expected=contents, message="cached file %s mismatch" % name)
def test_03_config_myproxy(self): core.skip_ok_unless_installed('myproxy-server') conFileContents = files.read('/usr/share/osg-test/test_myproxy_server.config') files.write('/etc/myproxy-server.config', conFileContents, owner='root', backup=True) if core.el_release() <= 6: core.config['myproxy.lock-file'] = '/var/lock/subsys/myproxy-server' else: core.config['myproxy.lock-file'] = '/var/run/myproxy-server/myproxy.pid'
def test_03_config_myproxy(self): core.skip_ok_unless_installed('myproxy-server') conFileContents = files.read('/usr/share/osg-test/test_myproxy_server.config') files.write('/etc/myproxy-server.config',conFileContents, owner='root', backup=True) if core.el_release() <= 6: core.config['myproxy.lock-file']='/var/lock/subsys/myproxy-server' else: core.config['myproxy.lock-file']='/var/run/myproxy-server/myproxy.pid'
def test_04_config_tomcat_endorsed_jars(self): core.skip_ok_unless_installed(tomcat.pkgname()) old_contents = files.read(tomcat.conffile(), True) line = 'JAVA_ENDORSED_DIRS="${JAVA_ENDORSED_DIRS+$JAVA_ENDORSED_DIRS:}/usr/share/voms-admin/endorsed"\n' if old_contents.find(line) == -1: new_contents = old_contents + "\n" + line files.write(tomcat.conffile(), new_contents, owner='tomcat')
def test_02_config_tomcat_properties(self): if core.missing_rpm(tomcat.pkgname(), 'emi-trustmanager-tomcat'): return server_xml_path = os.path.join(tomcat.sysconfdir(), 'server.xml') old_contents = files.read(server_xml_path, True) pattern = re.compile(r'crlRequired=".*?"', re.IGNORECASE) new_contents = pattern.sub('crlRequired="false"', old_contents) files.write(server_xml_path, new_contents, owner='tomcat')
def test_04_config_tomcat_endorsed_jars(self): if core.missing_rpm(tomcat.pkgname()): return old_contents = files.read(tomcat.conffile(), True) line = 'JAVA_ENDORSED_DIRS="${JAVA_ENDORSED_DIRS+$JAVA_ENDORSED_DIRS:}/usr/share/voms-admin/endorsed"\n' if old_contents.find(line) == -1: new_contents = old_contents + "\n" + line files.write(tomcat.conffile(), new_contents, owner='tomcat')
def test_03_configure_ce(self): core.skip_ok_unless_installed('condor', 'htcondor-ce', 'htcondor-ce-client') # Set up Condor, PBS, and Slurm routes # Leave the GRIDMAP knob in tact to verify that it works with the LCMAPS VOMS plugin core.config['condor-ce.condor-ce-cfg'] = '/etc/condor-ce/config.d/99-osgtest.condor-ce.conf' # Add host DN to condor_mapfile if core.options.hostcert: core.config['condor-ce.condorce_mapfile'] = '/etc/condor-ce/condor_mapfile.osg-test' hostcert_dn, _ = cagen.certificate_info(core.config['certs.hostcert']) mapfile_contents = files.read('/etc/condor-ce/condor_mapfile') mapfile_contents.insert(0, re.sub(r'([/=\.])', r'\\\1', "GSI \"^%s$\" " % hostcert_dn) + \ "%[email protected]\n" % core.get_hostname()) files.write(core.config['condor-ce.condorce_mapfile'], mapfile_contents, owner='condor-ce', chmod=0o644) else: core.config['condor-ce.condorce_mapfile'] = '/etc/condor-ce/condor_mapfile' condor_contents = """GRIDMAP = /etc/grid-security/grid-mapfile CERTIFICATE_MAPFILE = %s ALL_DEBUG=D_FULLDEBUG JOB_ROUTER_DEFAULTS = $(JOB_ROUTER_DEFAULTS) [set_default_maxMemory = 128;] JOB_ROUTER_ENTRIES = \\ [ \\ GridResource = "batch pbs"; \\ TargetUniverse = 9; \\ name = "Local_PBS"; \\ Requirements = target.osgTestBatchSystem =?= "pbs"; \\ ] \\ [ \\ GridResource = "batch slurm"; \\ TargetUniverse = 9; \\ name = "Local_Slurm"; \\ Requirements = target.osgTestBatchSystem =?= "slurm"; \\ ] \\ [ \\ TargetUniverse = 5; \\ name = "Local_Condor"; \\ Requirements = (target.osgTestBatchSystem =!= "pbs" && target.osgTestBatchSystem =!= "slurm"); \\ ] JOB_ROUTER_SCHEDD2_SPOOL=/var/lib/condor/spool JOB_ROUTER_SCHEDD2_NAME=$(FULL_HOSTNAME) JOB_ROUTER_SCHEDD2_POOL=$(FULL_HOSTNAME):9618 """ % core.config['condor-ce.condorce_mapfile'] if core.rpm_is_installed('htcondor-ce-view'): condor_contents += "\nDAEMON_LIST = $(DAEMON_LIST), CEVIEW, GANGLIAD, SCHEDD" core.config['condor-ce.view-port'] = condor.ce_config_val('HTCONDORCE_VIEW_PORT') files.write(core.config['condor-ce.condor-ce-cfg'], condor_contents, owner='condor-ce', chmod=0o644)
def assertCached(self, name, contents, auth=False): OriginExport = getcfg("OriginExport") if auth: OriginExport = getcfg("OriginAuthExport") fpath = os.path.join(getcfg("CacheRootdir"), getcfg("OriginExport").lstrip("/"), name) self.assertTrue(os.path.exists(fpath), name + " not cached") self.assertEqualVerbose(actual=core.to_str( files.read(fpath, as_single_string=True)), expected=contents, message="cached file %s mismatch" % name)
def setup_automount(self): automount_conf_path = '/etc/auto.master' try: contents = files.read(automount_conf_path) except IOError: #Sometimes this file doesn't exist contents = [] for line in contents: if "cvmfs" in line: return contents.append("/cvmfs /etc/auto.cvmfs\n") files.write(automount_conf_path, contents, 'root') os.chmod(automount_conf_path, 0644)
def setup_fuse(self): fuse_conf_path = '/etc/fuse.conf' try: contents = files.read(fuse_conf_path) except IOError: #Sometimes this file doesn't exist contents = [] for line in contents: if "user_allow_other" in line: return contents.append("user_allow_other\n") files.write(fuse_conf_path, contents, 'root') os.chmod(fuse_conf_path, 0644)
def test_01_configure(self): core.config['lcmaps.db'] = '/etc/lcmaps.db' core.config['lcmaps.gsi-authz'] = '/etc/grid-security/gsi-authz.conf' core.skip_ok_unless_installed(*self.required_rpms) template = files.read('/usr/share/lcmaps/templates/lcmaps.db.vomsmap', as_single_string=True) files.write(core.config['lcmaps.db'], template, owner='lcmaps') files.write(core.config['lcmaps.gsi-authz'], "globus_mapping liblcas_lcmaps_gt4_mapping.so lcmaps_callout\n", owner='lcmaps')
def setup_automount(): automount_conf_path = '/etc/auto.master' files.preserve(automount_conf_path, 'cvmfs') try: contents = files.read(automount_conf_path) except IOError: # Sometimes this file doesn't exist contents = [] for line in contents: if "cvmfs" in line: return contents.append("/cvmfs /etc/auto.cvmfs\n") files.write(automount_conf_path, contents, owner='cvmfs', backup=False, chmod=0o644)
def setup_fuse(): fuse_conf_path = '/etc/fuse.conf' files.preserve(fuse_conf_path, 'cvmfs') try: contents = files.read(fuse_conf_path) except IOError: # Sometimes this file doesn't exist contents = [] for line in contents: if "user_allow_other" in line: return contents.append("user_allow_other\n") files.write(fuse_conf_path, contents, owner='cvmfs', backup=False, chmod=0o644)
def test_09_config_user_vo_map(self): core.skip_ok_unless_installed('gratia-service') user_vo_map_file = '/var/lib/osg/user-vo-map' core.config['gratia.user-vo-map'] = user_vo_map_file conFileContents = files.read('/usr/share/osg-test/gratia/user-vo-map') if files.filesBackedup(user_vo_map_file, 'root'): files.write(core.config['gratia.user-vo-map'], conFileContents, backup=False) else: files.write(core.config['gratia.user-vo-map'], conFileContents, owner='root')
def setup_automount(self): automount_conf_path='/etc/auto.master' files.preserve(automount_conf_path, 'cvmfs') try: contents = files.read(automount_conf_path) except IOError: #Sometimes this file doesn't exist contents=[] for line in contents: if "cvmfs" in line: return contents.append("/cvmfs /etc/auto.cvmfs\n") files.write(automount_conf_path, contents, owner='cvmfs', backup=False, chmod=0644)
def setup_fuse(self): fuse_conf_path='/etc/fuse.conf' files.preserve(fuse_conf_path, 'cvmfs') try: contents = files.read(fuse_conf_path) except IOError: #Sometimes this file doesn't exist contents=[] for line in contents: if "user_allow_other" in line: return contents.append("user_allow_other\n") files.write(fuse_conf_path, contents, owner='cvmfs', backup=False, chmod=0644)
def test_02_config_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) old_contents = files.read(tomcat.conffile(), True) # Endorse JARs lines = ['JAVA_ENDORSED_DIRS="${JAVA_ENDORSED_DIRS+$JAVA_ENDORSED_DIRS:}/usr/share/voms-admin/endorsed"'] # Improve Tomcat 7 startup times (SOFTWARE-2383) lines.append('JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"') for line in lines: if old_contents.find(line) != -1: lines.remove(line) new_contents = '\n'.join([old_contents] + lines) files.write(tomcat.conffile(), new_contents, owner='tomcat')
def test_04_add_mysql_admin(self): core.skip_ok_unless_installed('gums-service') host_dn, _ = cagen.certificate_info(core.config['certs.hostcert']) mysql_template_path = '/usr/lib/gums/sql/addAdmin.mysql' self.assert_(os.path.exists(mysql_template_path), 'GUMS MySQL template exists') mysql_template = files.read(mysql_template_path, as_single_string=True).strip() core.log_message(mysql_template) mysql_command = re.sub(r'@ADMINDN@', host_dn, mysql_template) core.log_message(mysql_command) command = ('mysql', '--user=gums', '-p' + core.config['gums.password'], '--execute=' + mysql_command) core.check_system(command, 'Could not add GUMS MySQL admin')
def test_02_config_tomcat(self): core.skip_ok_unless_installed(tomcat.pkgname()) old_contents = files.read(tomcat.conffile(), True) # Endorse JARs lines = [ 'JAVA_ENDORSED_DIRS="${JAVA_ENDORSED_DIRS+$JAVA_ENDORSED_DIRS:}/usr/share/voms-admin/endorsed"' ] # Improve Tomcat 7 startup times (SOFTWARE-2383) lines.append('JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"') for line in lines: if old_contents.find(line) != -1: lines.remove(line) new_contents = '\n'.join([old_contents] + lines) files.write(tomcat.conffile(), new_contents, owner='tomcat')
def test_05_add_mysql_admin(self): if core.missing_rpm('gums-service'): return host_dn, host_issuer = core.certificate_info( core.config['certs.hostcert']) mysql_template_path = '/usr/lib/gums/sql/addAdmin.mysql' self.assert_(os.path.exists(mysql_template_path), 'GUMS MySQL template exists') mysql_template = files.read(mysql_template_path, as_single_string=True).strip() core.log_message(mysql_template) mysql_command = re.sub(r'@ADMINDN@', host_dn, mysql_template) core.log_message(mysql_command) command = ('mysql', '--user=gums', '-p' + core.config['gums.password'], '--execute=' + mysql_command) core.check_system(command, 'Add GUMS MySQL admin')
def test_07_ceview(self): core.config['condor-ce.view-listening'] = False core.skip_ok_unless_installed('htcondor-ce-view') view_url = 'http://%s:%s' % (core.get_hostname(), int(core.config['condor-ce.view-port'])) try: src = core.to_str(urlopen(view_url).read()) core.log_message(src) except EnvironmentError as err: debug_file = '/var/log/condor-ce/CEViewLog' debug_contents = 'Contents of %s\n%s\n' % (debug_file, '=' * 20) try: debug_contents += files.read(debug_file, True) except EnvironmentError: debug_contents += 'Failed to read %s\n' % debug_file core.log_message(debug_contents) self.fail('Could not reach HTCondor-CE View at %s: %s' % (view_url, err)) self.assertTrue(re.search(r'HTCondor-CE Overview', src), 'Failed to find expected CE View contents') core.config['condor-ce.view-listening'] = True
def check_status(service_name, expected_status, timeout=10, log_to_check = None): """ Return True if the exit code of the 'service_name' status check is expected_status before 'timeout' seconds. Otherwise, False. """ timer = 0 status_rc = None while timer < timeout and status_rc != expected_status: status_rc = status(service_name) time.sleep(1) timer += 1 if status_rc != expected_status and log_to_check: log_file_contents = files.read(log_to_check) core.log_message("Last lines of log: %s" % log_to_check) for line in log_file_contents[-9:]: core.log_message(line) return status_rc == expected_status
def test_07_config_va_properties(self): core.skip_ok_unless_installed('voms-admin-server') path = os.path.join('/etc/voms-admin', core.config['voms.vo'], 'voms.service.properties') contents = files.read(path) had_csrf_line = False for line in contents: if 'voms.csrf.log_only' in line: line = 'voms.csrf.log_only = true\n' had_csrf_line = True elif line[-1] != '\n': line = line + '\n' if not had_csrf_line: contents += 'voms.csrf.log_only = true\n' files.write(path, contents, backup=False)
def check_status(service_name, expected_status, timeout=10, log_to_check=None): """ Return True if the exit code of the 'service_name' status check is expected_status before 'timeout' seconds. Otherwise, False. """ timer = 0 status_rc = None while timer < timeout and status_rc != expected_status: status_rc = status(service_name) time.sleep(1) timer += 1 if status_rc != expected_status and log_to_check: log_file_contents = files.read(log_to_check) core.log_message("Last lines of log: %s" % log_to_check) for line in log_file_contents[-9:]: core.log_message(line) return status_rc == expected_status
def test_03_configure_authentication(self): core.skip_ok_unless_installed('condor', 'htcondor-ce', 'htcondor-ce-client') # Configure condor-ce to use the gridmap file and set up PBS and Condor routes core.config['condor-ce.condor-ce-cfg'] = '/etc/condor-ce/config.d/99-osgtest.condor-ce.conf' condor_contents = """GRIDMAP = /etc/grid-security/grid-mapfile ALL_DEBUG=D_FULLDEBUG JOB_ROUTER_ENTRIES = \\ [ \\ GridResource = "batch pbs"; \\ TargetUniverse = 9; \\ name = "Local_PBS"; \\ Requirements = target.osgTestPBS =?= true; \\ ] \\ [ \\ TargetUniverse = 5; \\ name = "Local_Condor"; \\ ] JOB_ROUTER_SCHEDD2_SPOOL=/var/lib/condor/spool JOB_ROUTER_SCHEDD2_NAME=$(FULL_HOSTNAME) JOB_ROUTER_SCHEDD2_POOL=$(FULL_HOSTNAME):9618 """ files.write(core.config['condor-ce.condor-ce-cfg'], condor_contents, owner='condor-ce', chmod=0644) # lcmaps needs to know to use the gridmap file instead of GUMS core.config['condor-ce.lcmapsdb'] = '/etc/lcmaps.db' lcmaps_contents = """ authorize_only: gridmapfile -> good | bad """ files.append(core.config['condor-ce.lcmapsdb'], lcmaps_contents, owner='condor-ce') # Add host DN to condor_mapfile if core.options.hostcert: core.config['condor-ce.condorce_mapfile'] = '/etc/condor-ce/condor_mapfile' condor_mapfile_contents = files.read('/usr/share/osg-test/test_condorce_mapfile') files.write(core.config['condor-ce.condorce_mapfile'], condor_mapfile_contents, owner='condor-ce', chmod=0644)
def debug_cvmfs(self, repo): temp_dir = tempfile.mkdtemp() core.config['cvmfs.debug-dirs'].append(temp_dir) command = ('mount', '-t', 'cvmfs', repo, temp_dir) status, _, _ = core.system(command) # If manual mount works, autofs is likely the culprit if status: debug_contents = "Failed to manually mount %s\n" % repo else: debug_contents = "Successful manual mount of %s\n" % repo debug_file = "/tmp/cvmfs_debug.log" debug_contents += ('=' * 20) + "\n" try: debug_contents += files.read(debug_file, True) except IOError: debug_contents += 'Failed to read %s' % debug_file self.fail(debug_contents)
def test_02_edg_mkgridmap(self): if core.missing_rpm('edg-mkgridmap', 'voms-server'): return command = ('edg-mkgridmap', '--conf', core.config['edg.conf']) os.environ['GRIDMAP'] = '/usr/share/osg-test/grid-mapfile' os.environ['USER_VO_MAP'] = '/usr/share/osg-test/user-vo-map' os.environ['EDG_MKGRIDMAP_LOG'] = \ '/usr/share/osg-test/edg-mkgridmap.log' os.environ['VO_LIST_FILE'] = '/usr/share/osg-test/vo-list-file' os.environ['UNDEFINED_ACCTS_FILE'] = '/usr/share/osg-test/undef-ids' core.check_system(command, 'Run edg-mkgridmap') pwd_entry = pwd.getpwnam(core.options.username) cert_path = os.path.join(pwd_entry.pw_dir, '.globus', 'usercert.pem') user_cert_dn, user_cert_issuer = core.certificate_info(cert_path) expected = '"%s" %s' % (user_cert_dn, core.options.username) contents = files.read(os.environ['GRIDMAP'], True) self.assert_(expected in contents, 'Expected grid-mapfile contents')
def test_02_edg_mkgridmap(self): core.skip_ok_unless_installed('edg-mkgridmap', 'voms-server') command = ('edg-mkgridmap', '--conf', core.config['edg.conf']) os.environ['GRIDMAP'] = '/usr/share/osg-test/grid-mapfile' os.environ['USER_VO_MAP'] = '/usr/share/osg-test/user-vo-map' os.environ['EDG_MKGRIDMAP_LOG'] = \ '/usr/share/osg-test/edg-mkgridmap.log' os.environ['VO_LIST_FILE'] = '/usr/share/osg-test/vo-list-file' os.environ['UNDEFINED_ACCTS_FILE'] = '/usr/share/osg-test/undef-ids' core.check_system(command, 'Run edg-mkgridmap') core.system(('cat', os.environ['GRIDMAP'])) core.system(('cat', os.environ['EDG_MKGRIDMAP_LOG'])) pwd_entry = pwd.getpwnam(core.options.username) cert_path = os.path.join(pwd_entry.pw_dir, '.globus', 'usercert.pem') user_cert_dn, _ = cagen.certificate_info(cert_path) expected = '"%s" %s' % (user_cert_dn, core.options.username) contents = files.read(os.environ['GRIDMAP'], True) self.assert_(expected in contents, 'Expected grid-mapfile contents')
def test_04_modify_bestman_conf(self): core.skip_ok_unless_installed('bestman2-server', 'bestman2-client') bestman_rc_path = '/etc/bestman2/conf/bestman2.rc' old_port = 'securePort=8443' new_port = 'securePort=10443' files.replace(bestman_rc_path, old_port, new_port, backup=False) old_gridmap = 'GridMapFileName=/etc/bestman2/conf/grid-mapfile.empty' new_gridmap = 'GridMapFileName=/etc/grid-security/grid-mapfile' files.replace(bestman_rc_path, old_gridmap, new_gridmap, backup=False) files.replace(bestman_rc_path, 'eventLogLevel=INFO', 'eventLogLevel=DEBUG', backup=False) core.system(('cat', bestman_rc_path)) env_file = '/etc/sysconfig/bestman2' old_auth = 'BESTMAN_GUMS_ENABLED=yes' new_auth = 'BESTMAN_GUMS_ENABLED=no' files.replace(env_file, old_auth, new_auth, backup=False) log4j_path = '/etc/bestman2/properties/log4j.properties' log4j_contents = files.read(log4j_path, as_single_string=True) log4j_contents = log4j_contents.replace('FATAL', 'INFO') files.write(log4j_path, log4j_contents, backup=False)