def test_01_start_munge(self): if core.el_release() == 5: core.config['munge.lockfile'] = '/var/lock/subsys/munge' elif core.el_release() == 6: core.config['munge.lockfile'] = '/var/lock/subsys/munged' core.config['munge.keyfile'] = '/etc/munge/munge.key' core.state['munge.running'] = False if core.missing_rpm(*self.required_rpms): return if os.path.exists(core.config['munge.lockfile']): core.skip('munge apparently running') return files.preserve(core.config['munge.keyfile'], 'pbs') command = ( '/usr/sbin/create-munge-key', '-f', ) stdout, _, fail = core.check_system(command, 'Create munge key') self.assert_(stdout.find('error') == -1, fail) command = ('service', 'munge', 'start') stdout, _, fail = core.check_system(command, 'Start munge daemon') self.assert_(stdout.find('error') == -1, fail) self.assert_(os.path.exists(core.config['munge.lockfile']), 'munge lock file missing') core.state['munge.running'] = True
def modify_probeconfig(self, probeconfig): """This helper method modifies the Probe Configuration, generally needed by many probes""" #Backup the existing ProbeConfig, before any modification, so that it can be restored later #Note that "owner" has to be a unique string since "ProbeConfig" filename is the same for all probes #If ProbeConfig path is: /etc/gratia/gridftp-transfer/ProbeConfig, "owner" = "gridftp-transfer" owner = os.path.basename(os.path.dirname(probeconfig)) files.preserve(probeconfig, owner) host = core.get_hostname() collectorhost = " CollectorHost=\"" + host + ":8880\"" sslhost = " SSLHost=\"" + host + ":8443\"" sslregistrationhost = " SSLRegistrationHost=\"" + host + ":8880\"" self.patternreplace(probeconfig, "CollectorHost", collectorhost) self.patternreplace(probeconfig, "SSLHost", sslhost) self.patternreplace(probeconfig, "SSLRegistrationHost", sslregistrationhost) self.patternreplace(probeconfig, "SiteName", "SiteName=\"OSG Test site\"") self.patternreplace(probeconfig, "EnableProbe", "EnableProbe=\"1\"") #If a line with QuarantineUnknownVORecords pattern is not found, insert it after QuarantineSize line if self.patternreplace(probeconfig, "QuarantineUnknownVORecords=", "QuarantineUnknownVORecords=\"0\"") == False: self.patternreplace(probeconfig, "QuarantineSize=", "QuarantineUnknownVORecords=\"0\"", insert_after=True)
def test_04_configure_pbs(self): core.config[ 'torque.pbs-nodes-file'] = '/var/lib/torque/server_priv/nodes' core.config[ 'torque.pbs-serverdb'] = '/var/lib/torque/server_priv/serverdb' core.skip_ok_unless_installed(*self.required_rpms, by_dependency=True) self.skip_bad_unless(service.is_running('trqauthd'), 'pbs_server requires trqauthd') self.skip_ok_if(service.is_running('pbs_server'), 'pbs server already running') files.preserve(core.config['torque.pbs-serverdb'], 'pbs') if not os.path.exists(core.config['torque.pbs-serverdb']): command = ( '/usr/sbin/pbs_server -d /var/lib/torque -t create -f && ' 'sleep 10 && /usr/bin/qterm') stdout, _, fail = core.check_system( command, 'create initial pbs serverdb config', shell=True) self.assert_(stdout.find('error') == -1, fail) # This gets wiped if we write it before the initial 'service pbs_server create' # However, this file needs to be in place before the service is started so we # restart the service after 'initial configuration' files.write( core.config[ 'torque.pbs-nodes-file'], # add the local node as a compute node "%s np=1 num_node_boards=1\n" % core.get_hostname(), owner='pbs')
def test_08_advertise(self): voms.skip_ok_unless_installed() voms.advertise_lsc(core.config['voms.vo'], core.config['certs.hostcert']) files.preserve('/etc/vomses', owner='voms') voms.advertise_vomses(core.config['voms.vo'], core.config['certs.hostcert']) core.system('ls -ldF /etc/*vom*', shell=True) core.system(('find', '/etc/grid-security/vomsdir', '-ls'))
def test_01_start_munge(self): core.config['munge.keyfile'] = '/etc/munge/munge.key' core.state['munge.started-service'] = False core.skip_ok_unless_installed('munge') self.skip_ok_if(service.is_running('munge'), 'already running') files.preserve(core.config['munge.keyfile'], 'munge') command = ('/usr/sbin/create-munge-key', '-f',) stdout, _, fail = core.check_system(command, 'Create munge key') self.assert_(stdout.find('error') == -1, fail) service.check_start('munge')
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 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_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_01_start_munge(self): core.config['munge.keyfile'] = '/etc/munge/munge.key' core.state['munge.started-service'] = False core.skip_ok_unless_installed('munge') self.skip_ok_if(service.is_running('munge'), 'already running') files.preserve(core.config['munge.keyfile'], 'munge') command = ( '/usr/sbin/create-munge-key', '-f', ) stdout, _, fail = core.check_system(command, 'Create munge key') self.assert_(stdout.find('error') == -1, fail) service.check_start('munge')
def test_04_configure_pbs(self): core.config['torque.pbs-nodes-file'] = '/var/lib/torque/server_priv/nodes' core.config['torque.pbs-serverdb'] = '/var/lib/torque/server_priv/serverdb' core.skip_ok_unless_installed(*self.required_rpms, by_dependency=True) self.skip_bad_unless(service.is_running('trqauthd'), 'pbs_server requires trqauthd') self.skip_ok_if(service.is_running('pbs_server'), 'pbs server already running') files.preserve(core.config['torque.pbs-serverdb'], 'pbs') if not os.path.exists(core.config['torque.pbs-serverdb']): command = ('/usr/sbin/pbs_server -d /var/lib/torque -t create -f && ' 'sleep 10 && /usr/bin/qterm') stdout, _, fail = core.check_system(command, 'create initial pbs serverdb config', shell=True) self.assert_(stdout.find('error') == -1, fail) # This gets wiped if we write it before the initial 'service pbs_server create' # However, this file needs to be in place before the service is started so we # restart the service after 'initial configuration' files.write(core.config['torque.pbs-nodes-file'], # add the local node as a compute node "%s np=1 num_node_boards=1\n" % core.get_hostname(), owner='pbs')
def test_01_start_munge(self): if core.el_release() == 5: core.config['munge.lockfile'] = '/var/lock/subsys/munge' elif core.el_release() == 6: core.config['munge.lockfile'] = '/var/lock/subsys/munged' elif core.el_release() == 7: core.config['munge.lockfile'] = '/var/run/munge/munged.pid' core.config['munge.keyfile'] = '/etc/munge/munge.key' core.state['munge.running'] = False core.skip_ok_unless_installed(*self.required_rpms) self.skip_ok_if(os.path.exists(core.config['munge.lockfile']), 'already running') files.preserve(core.config['munge.keyfile'], 'pbs') command = ('/usr/sbin/create-munge-key', '-f',) stdout, _, fail = core.check_system(command, 'Create munge key') self.assert_(stdout.find('error') == -1, fail) command = ('service', 'munge', 'start') stdout, _, fail = core.check_system(command, 'Start munge daemon') self.assert_(stdout.find('error') == -1, fail) self.assert_(os.path.exists(core.config['munge.lockfile']), 'munge lock file missing') core.state['munge.running'] = True