Skip to content

Commit db47cae

Browse files
authored
Merge branch 'master' into SOFTWARE-3347.slurm-from-non-devel
2 parents f404f40 + 43a7d19 commit db47cae

32 files changed

+137
-137
lines changed

bootstrap-osg-test

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
UPSTREAM=https://github.com/opensciencegrid
4+
35
on_error_die()
46
{
57
if [ $? -ne 0 ]; then
@@ -11,32 +13,6 @@ on_error_die()
1113
fi
1214
}
1315

14-
if [ $# -lt 1 ]; then
15-
echo "Requires the major version number, i.e. 3.2 for 3.2.0"
16-
echo "usage: $0 <major version> [testing|development]"
17-
exit 1
18-
fi
19-
20-
if [[ $1 =~ ^[0-9]+\.[0-9]+$ ]]; then
21-
version=$1
22-
else
23-
echo "Major version should be in the form of '<number>.<number>, i.e. 3.2"
24-
echo "usage: $0 <major version> [testing|development]"
25-
exit 1
26-
fi
27-
28-
extra_repo=
29-
case $2 in
30-
test|testing) extra_repo='--enablerepo=osg-testing';;
31-
dev|development) extra_repo='--enablerepo=osg-development';;
32-
'') ;;
33-
*)
34-
echo "$0: unknown option '$1'"
35-
echo "usage: $0 <major version> [testing|development]"
36-
exit 1
37-
;;
38-
esac
39-
4016
# Determine platform-specific details
4117
release=`cat /etc/redhat-release`
4218
case $release in
@@ -100,11 +76,13 @@ echo -n 'Verify yum-plugin-priorities... '
10076
rpm --verify yum-plugin-priorities
10177
on_error_die "Could not verify yum-plugin-priorities"
10278

103-
# Always erase and install, to get latest
104-
rpm -e osg-test >/dev/null 2>&1
105-
echo -n "Install osg-test... "
106-
yum -y --quiet $extra_repo install osg-test
107-
on_error_die "Could not install osg-test"
108-
echo -n 'Verify osg-test... '
109-
rpm --verify osg-test
110-
on_error_die "Could not verify osg-test"
79+
cd /tmp
80+
for repo in osg-test osg-ca-generator; do
81+
git clone $UPSTREAM/$repo
82+
on_error_die "Failed to clone $UPSTREAM/$repo"
83+
pushd $repo
84+
make install
85+
on_error_die "Failed to install $repo"
86+
popd
87+
done
88+

osg-test

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/python
22

3+
from __future__ import print_function
34
from distutils.sysconfig import get_python_lib
45
from optparse import OptionParser
56
import ConfigParser
@@ -55,7 +56,7 @@ def parse_command_line():
5556
config_file = ConfigParser.RawConfigParser()
5657
try:
5758
config_file.read(opts.config)
58-
except ConfigParser.ParsingError, exc:
59+
except ConfigParser.ParsingError as exc:
5960
sys.stderr.write("Error while parsing: %s\n%s\n" % (opts.config, exc))
6061
sys.stderr.write("Lines with options should not start with a space\n")
6162
sys.exit(1)
@@ -168,7 +169,7 @@ def get_password():
168169
if core.options.securepass:
169170
# If the user also specifies password on the command line, we complain
170171
if core.options.password != 'vdttest':
171-
print 'Only specify one of --password and --securepass'
172+
print('Only specify one of --password and --securepass')
172173
sys.exit(1)
173174
core.options.password = getpass()
174175

@@ -252,6 +253,6 @@ if __name__ == '__main__':
252253
signal.alarm(0)
253254
signal.signal(signal.SIGALRM, signal.SIG_DFL)
254255
else:
255-
print 'No tests to run.'
256+
print('No tests to run.')
256257
wrap_up()
257258
sys.exit(EXIT_CODE)

osgtest/library/core.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Support and convenience functions for tests."""
2+
from __future__ import print_function
23

34
import errno
45
import os
@@ -127,9 +128,9 @@ def end_log():
127128
def dump_log(outfile=None):
128129
if outfile is None:
129130
logfile = open(_log_filename, 'r')
130-
print '\n'
131+
print('\n')
131132
for line in logfile:
132-
print line.rstrip('\n')
133+
print(line.rstrip('\n'))
133134
logfile.close()
134135
else:
135136
shutil.copy(_log_filename, outfile)
@@ -143,7 +144,7 @@ def get_stat(filename):
143144
'''Return stat for 'filename', None if the file does not exist'''
144145
try:
145146
return os.stat(filename)
146-
except OSError, exc:
147+
except OSError as exc:
147148
if exc.errno == errno.ENOENT:
148149
return None
149150
raise
@@ -493,7 +494,7 @@ def __run_command(command, use_test_user, a_input, a_stdout, a_stderr, log_outpu
493494
try:
494495
repr(command)
495496
except TypeError:
496-
print 'Need list or tuple, got %s' % type(command)
497+
print('Need list or tuple, got %s' % type(command))
497498
if use_test_user:
498499
command = ['runuser', options.username, '-c', ' '.join(map(__prepare_shell_argument, command))]
499500

@@ -603,7 +604,7 @@ def el_release():
603604
release_file.close()
604605
match = re.search(r"release (\d)", release_text)
605606
_el_release = int(match.group(1))
606-
except (EnvironmentError, TypeError, ValueError), e:
607+
except (EnvironmentError, TypeError, ValueError) as e:
607608
_log.write("Couldn't determine redhat release: " + str(e) + "\n")
608609
sys.exit(1)
609610
return _el_release
@@ -642,7 +643,7 @@ def check_file_and_perms(file_path, owner_name, permissions):
642643
try:
643644
file_stat = os.stat(file_path)
644645
return (file_stat.st_uid == owner_uid and
645-
file_stat.st_mode & 07777 == permissions and
646+
file_stat.st_mode & 0o7777 == permissions and
646647
stat.S_ISREG(file_stat.st_mode))
647648
except OSError: # file does not exist
648649
return False
@@ -684,7 +685,7 @@ def install_cert(target_key, source_key, owner_name, permissions):
684685
os.makedirs(target_dir)
685686
state[target_key + '-dir'] = target_dir
686687
os.chown(target_dir, user.pw_uid, user.pw_gid)
687-
os.chmod(target_dir, 0755)
688+
os.chmod(target_dir, 0o755)
688689

689690
shutil.copy(source_path, target_path)
690691
state[target_key] = target_path
@@ -697,12 +698,12 @@ def remove_cert(target_key):
697698
paths associated with the key, as created by the install_cert()
698699
function.
699700
"""
700-
if state.has_key(target_key):
701+
if target_key in state:
701702
os.remove(state[target_key])
702-
if state.has_key(target_key + '-backup'):
703+
if target_key + '-backup' in state:
703704
shutil.move(state[target_key + '-backup'],
704705
state[target_key])
705-
if state.has_key(target_key + '-dir'):
706+
if target_key + '-dir' in state:
706707
target_dir = state[target_key + '-dir']
707708
if len(os.listdir(target_dir)) == 0:
708709
os.rmdir(target_dir)

osgtest/library/files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def preserve(path, owner):
7474
else:
7575
_backups[backup_id] = None
7676

77-
def write(path, contents, owner=None, backup=True, chown=(0,0), chmod=0600):
77+
def write(path, contents, owner=None, backup=True, chown=(0,0), chmod=0o600):
7878
"""Write the contents to a file at the path.
7979
8080
The 'owner' argument (default: None) is a string that identifies the owner

osgtest/library/osgunittest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,41 +75,41 @@ def __init__(self, methodName='runTest'):
7575

7676
def skip_ok(self, message=None):
7777
"Skip (ok) unconditionally"
78-
raise OkSkipException, message
78+
raise OkSkipException(message)
7979

8080
def skip_ok_if(self, expr, message=None):
8181
"Skip (ok) if the expression is true"
8282
if expr:
83-
raise OkSkipException, message
83+
raise OkSkipException(message)
8484

8585
def skip_ok_unless(self, expr, message=None):
8686
"Skip (ok) if the expression is false"
8787
if not expr:
88-
raise OkSkipException, message
88+
raise OkSkipException(message)
8989

9090
def skip_bad(self, message=None):
9191
"Skip (bad) unconditionally"
92-
raise BadSkipException, message
92+
raise BadSkipException(message)
9393

9494
def skip_bad_if(self, expr, message=None):
9595
"Skip (bad) if the expression is true"
9696
if expr:
97-
raise BadSkipException, message
97+
raise BadSkipException(message)
9898

9999
def skip_bad_unless(self, expr, message=None):
100100
"Skip (bad) if the expression is false"
101101
if not expr:
102-
raise BadSkipException, message
102+
raise BadSkipException(message)
103103

104104
def assertSubsetOf(self, a, b, message=None):
105105
"Ensure that a is a subset of b "
106106
if not set(a).issubset(set(b)):
107-
raise AssertionError, message
107+
raise AssertionError(message)
108108

109109
def failIfSubsetOf(self, a, b, message=None):
110110
"Ensure that a is not a subset of b"
111111
if set(a).issubset(set(b)):
112-
raise AssertionError, message
112+
raise AssertionError(message)
113113

114114
# This is mostly a copy of the method from unittest in python 2.4.
115115
# There is some code here to test if the 'result' object accepts 'skips',

osgtest/library/voms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def advertise_lsc(vo, hostcert='/etc/grid-security/hostcert.pem'):
7474
if not os.path.isdir(lsc_dir):
7575
os.makedirs(lsc_dir)
7676
vo_lsc_path = os.path.join(lsc_dir, hostname + '.lsc')
77-
files.write(vo_lsc_path, (host_dn + '\n', host_issuer + '\n'), backup=False, chmod=0644)
77+
files.write(vo_lsc_path, (host_dn + '\n', host_issuer + '\n'), backup=False, chmod=0o644)
7878

7979

8080
def advertise_vomses(vo, hostcert='/etc/grid-security/hostcert.pem'):
@@ -86,7 +86,7 @@ def advertise_vomses(vo, hostcert='/etc/grid-security/hostcert.pem'):
8686
vomses_path = '/etc/vomses'
8787
contents = ('"%s" "%s" "%d" "%s" "%s"\n' %
8888
(vo, hostname, 15151, host_dn, vo))
89-
files.write(vomses_path, contents, backup=False, chmod=0644)
89+
files.write(vomses_path, contents, backup=False, chmod=0o644)
9090

9191

9292
def add_user(vo, usercert, use_voms_admin=False):

osgtest/tests/special_cleanup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test_06_cleanup_test_certs(self):
134134
dest = os.readlink(abs_link_path)
135135
if re.match(r'OSG-Test-CA\.', dest):
136136
files.remove(abs_link_path)
137-
except OSError, e:
137+
except OSError as e:
138138
if e.errno == errno.EINVAL:
139139
continue
140140

osgtest/tests/special_install.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ def test_02_install_packages(self):
3333
# FIXME: Install slurm out of contrib if we're running 'All' tests until
3434
# SOFTWARE-1733 gives us a generalized solution
3535
if 'osg-tested-internal' in pkg_repo_dict or 'slurm' in pkg_repo_dict:
36-
all_slurm_packages = core.SLURM_PACKAGES + ['slurm-slurmdbd']
37-
pkg_repo_dict.update(dict((x, ['osg-development']) for x in all_slurm_packages))
36+
pkg_repo_dict.update(dict((x, ['osg-development']) for x in core.SLURM_PACKAGES))
3837

3938
for pkg, repos in pkg_repo_dict.items():
4039
# Do not try to re-install packages

osgtest/tests/special_user.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_01_add_user(self):
6363
# Set up directories
6464
user = pwd.getpwnam(core.options.username)
6565
os.chown(user.pw_dir, user.pw_uid, user.pw_gid)
66-
os.chmod(user.pw_dir, 0755)
66+
os.chmod(user.pw_dir, 0o755)
6767

6868
# Set up certificate
6969
globus_dir = os.path.join(user.pw_dir, '.globus')
@@ -80,7 +80,7 @@ def test_02_user(self):
8080
return
8181
try:
8282
password_entry = pwd.getpwnam(core.options.username)
83-
except KeyError, e:
83+
except KeyError as e:
8484
self.fail("User '%s' should exist but does not" % core.options.username)
8585
self.assert_(password_entry.pw_dir != '/', "User '%s' has home directory at '/'" % (core.options.username))
8686
self.assert_(os.path.isdir(password_entry.pw_dir),
@@ -93,4 +93,4 @@ def test_02_user(self):
9393
(core.config['user.cert_subject'], password_entry.pw_name),
9494
owner='user')
9595
core.state['system.wrote_mapfile'] = True
96-
os.chmod(core.config['system.mapfile'], 0644)
96+
os.chmod(core.config['system.mapfile'], 0o644)

osgtest/tests/test_05_mysqld.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_01_backup_mysql(self):
2828
self.assert_(not os.path.exists(backup), 'mysql-backup already exists')
2929
try:
3030
shutil.move(core.config['mysql.datadir'], backup)
31-
except IOError, e:
31+
except IOError as e:
3232
if e.errno == 2:
3333
# Folder doesn't exist so we don't have to worry about backups
3434
pass

0 commit comments

Comments
 (0)