@@ -27,43 +27,25 @@ def _get_sqlloc():
27
27
return voms_mysql_so_path
28
28
29
29
30
- def create_vo (vo , dbusername = 'voms_osgtest' , dbpassword = 'secret' , vomscert = '/etc/grid-security/voms/vomscert.pem' , vomskey = '/etc/grid-security/voms/vomskey.pem' , use_voms_admin = False ):
31
- """Create the given VO using either voms-admin or the voms_install_db script that comes with voms-server. A new
30
+ def create_vo (vo , dbusername = 'voms_osgtest' , dbpassword = 'secret' , vomscert = '/etc/grid-security/voms/vomscert.pem' , vomskey = '/etc/grid-security/voms/vomskey.pem' ):
31
+ """Create the given VO using the voms_install_db script that comes with voms-server. A new
32
32
database user with the given username/password is created with access to the VO database.
33
33
"""
34
- if use_voms_admin :
35
- command = ('voms-admin-configure' , 'install' ,
36
- '--vo' , vo ,
37
- '--dbtype' , 'mysql' , '--createdb' , '--deploy-database' ,
38
- '--dbauser' , 'root' , '--dbapwd' , '' , '--dbport' , '3306' ,
39
- '--dbusername' , dbusername , '--dbpassword' , dbpassword ,
40
- '--port' , '15151' , '--sqlloc' , _get_sqlloc (),
41
- '--mail-from' , 'root@localhost' , '--smtp-host' , 'localhost' ,
42
- '--cert' , vomscert ,
43
- '--key' , vomskey ,
44
- '--read-access-for-authenticated-clients' )
45
-
46
- stdout , _ , fail = core .check_system (command , 'Configure VOMS Admin' )
47
- good_message = 'VO %s installation finished' % vo
48
- assert good_message in stdout , fail
49
-
50
- else :
51
-
52
- mysql .execute ("CREATE USER '%(dbusername)s'@'localhost';" % locals ())
53
-
54
- command = ['/usr/share/voms/voms_install_db' ,
55
- '--voms-vo=' + vo ,
56
- '--port=15151' ,
57
- '--db-type=mysql' ,
58
- '--db-admin=root' ,
59
- '--voms-name=' + dbusername ,
60
- '--voms-pwd=' + dbpassword ,
61
- '--sqlloc=' + _get_sqlloc (),
62
- '--vomscert=' + vomscert ,
63
- '--vomskey=' + vomskey ,
64
- ]
65
-
66
- core .check_system (command , 'Create VO' )
34
+ mysql .execute ("CREATE USER '%(dbusername)s'@'localhost';" % locals ())
35
+
36
+ command = ['/usr/share/voms/voms_install_db' ,
37
+ '--voms-vo=' + vo ,
38
+ '--port=15151' ,
39
+ '--db-type=mysql' ,
40
+ '--db-admin=root' ,
41
+ '--voms-name=' + dbusername ,
42
+ '--voms-pwd=' + dbpassword ,
43
+ '--sqlloc=' + _get_sqlloc (),
44
+ '--vomscert=' + vomscert ,
45
+ '--vomskey=' + vomskey ,
46
+ ]
47
+
48
+ core .check_system (command , 'Create VO' )
67
49
68
50
69
51
def advertise_lsc (vo , hostcert = '/etc/grid-security/hostcert.pem' ):
@@ -89,33 +71,25 @@ def advertise_vomses(vo, hostcert='/etc/grid-security/hostcert.pem'):
89
71
files .write (vomses_path , contents , backup = False , chmod = 0o644 )
90
72
91
73
92
- def add_user (vo , usercert , use_voms_admin = False ):
93
- """Add the user identified by the given cert to the specified VO. May use voms-admin or direct MySQL statements.
74
+ def add_user (vo , usercert ):
75
+ """Add the user identified by the given cert to the specified VO. Uses direct MySQL statements instead of voms-admin .
94
76
The CA cert that issued the user cert must already be in the database's 'ca' table - this happens automatically if
95
77
the CA cert is in /etc/grid-security/certificates when the VOMS database is created.
96
78
"""
97
79
usercert_dn , usercert_issuer = cagen .certificate_info (usercert )
98
- if use_voms_admin :
99
- hostname = socket .getfqdn ()
100
-
101
- command = ('voms-admin' , '--vo' , core .config ['voms.vo' ], '--host' , hostname , '--nousercert' , 'create-user' ,
102
- usercert_dn , usercert_issuer , 'OSG Test User' , 'root@localhost' )
103
- core .check_system (command , 'Add VO user' )
104
-
105
- else :
106
- dbname = 'voms_' + vo
80
+ dbname = 'voms_' + vo
107
81
108
- # Find the index in the "ca" table ("cid") for the OSG Test CA that gets created by voms_install_db.
109
- output , _ , _ , = mysql .check_execute (r'''SELECT cid FROM ca WHERE ca='%(usercert_issuer)s';''' % locals (),
110
- 'Get ID of user cert issuer from database' , dbname )
111
- output = output .strip ()
112
- assert output , "User cert issuer not found in database"
113
- ca = int (output )
82
+ # Find the index in the "ca" table ("cid") for the OSG Test CA that gets created by voms_install_db.
83
+ output , _ , _ , = mysql .check_execute (r'''SELECT cid FROM ca WHERE ca='%(usercert_issuer)s';''' % locals (),
84
+ 'Get ID of user cert issuer from database' , dbname )
85
+ output = output .strip ()
86
+ assert output , "User cert issuer not found in database"
87
+ ca = int (output )
114
88
115
- mysql .check_execute (r'''
116
- INSERT INTO `usr` VALUES (1,'%(usercert_dn)s',%(ca)d,NULL,'root@localhost',NULL);
117
- INSERT INTO `m` VALUES (1,1,1,NULL,NULL);''' % locals (),
118
- 'Add VO user' , dbname )
89
+ mysql .check_execute (r'''
90
+ INSERT INTO `usr` VALUES (1,'%(usercert_dn)s',%(ca)d,NULL,'root@localhost',NULL);
91
+ INSERT INTO `m` VALUES (1,1,1,NULL,NULL);''' % locals (),
92
+ 'Add VO user' , dbname )
119
93
120
94
121
95
def destroy_lsc (vo ):
@@ -148,12 +122,6 @@ def is_installed():
148
122
if not core .dependency_is_installed (dep ):
149
123
return False
150
124
151
- # TODO: drop this check when 3.3 is completely EOL
152
- if core .el_release () >= 7 :
153
- if core .PackageVersion ('voms-server' ) < '2.0.12-3.2' :
154
- core .log_message ("voms-server installed but too old (missing SOFTWARE-2357 fix)" )
155
- return False
156
-
157
125
return True
158
126
159
127
0 commit comments