/[pdpsoft]/trunk/nl.nikhef.ndpf.tools/globus-gram5-glue2-info-providers/globus-info-gip-gram5-glue2-manager-static
ViewVC logotype

Contents of /trunk/nl.nikhef.ndpf.tools/globus-gram5-glue2-info-providers/globus-info-gip-gram5-glue2-manager-static

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2531 - (show annotations) (download)
Wed Apr 25 14:32:26 2012 UTC (9 years, 9 months ago) by davidg
File size: 4140 byte(s)
Add verbatim copies of creamce tools to reduce dependencies

1 #!/usr/bin/perl -w
2 #
3 # glite-ce-glue2-manager-static: an information provider for the
4 # static part of the Manager object, in v 2.0 of the GLUE schema
5 # It can be installed as a gip provider or, even better, it can be called
6 # just once to produce a ldif part to be installed in the ldif
7 # gip directory
8 #
9 # Author: Massimo Sgaravatto
10 #
11 # Ref: http://www.ogf.org/documents/GFD.147.pdf
12 # http://glue20.web.cern.ch/glue20/
13 # Copyright (c) Members of the EGEE Collaboration. 2010.
14 # See http://www.eu-egee.org/partners/ for details on the copyright
15 # holders.
16 #
17 # Licensed under the Apache License, Version 2.0 (the "License");
18 # you may not use this file except in compliance with the License.
19 # You may obtain a copy of the License at
20 #
21 # http://www.apache.org/licenses/LICENSE-2.0
22 #
23 # Unless required by applicable law or agreed to in writing, software
24 # distributed under the License is distributed on an "AS IS" BASIS,
25 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 # See the License for the specific language governing permissions and
27 # limitations under the License.
28
29 use strict;
30 use FileHandle;
31 use POSIX qw(strftime);
32
33 #
34 # Version number for this code
35 my $version = "1.0";
36
37
38 my $host = `hostname -f`;
39 chomp($host);
40
41 my $confile;
42
43 # Read in the configuration file (first argument)
44
45 my %config = (
46 ComputingServiceId => '',
47 CE_BATCH_SYS => '',
48 BATCH_VERSION => '',
49 );
50
51 if ($ARGV[0]){
52 $confile = $ARGV[0];
53 my $fh = new FileHandle $confile
54 or die "Error: Can't open configuration file: $ARGV[0]\n";
55 foreach (<$fh>){
56 if ((! m/^\#/) & (m/=/)){
57 # For lines containing an = and not starting with #
58 m/^(.*?)=\s*(.*)\s*$/;
59 # Split on the first =, no leading or trailing whitespace in the value
60 my $key=$1;
61 my $value=$2;
62 $key=~s/\s+//g;
63 $config{$key}=$value;
64 }
65 }
66 }else{
67 print STDERR "Usage: glite-ce-glue2-manager-static <config-file> \n";
68 exit 1;
69 }
70
71
72 # Get service id from conf file
73 my $ServiceID = $config{ComputingServiceId};
74
75 # No white space. No "
76 $ServiceID =~ s/\s+//g;
77 $ServiceID =~ s/\"//g;
78
79 # ManagerId is ServiceId + "_Manager"
80 my $ManagerId = $ServiceID . "_Manager";
81
82 my $bind_dn = "GLUE2ServiceID=$ServiceID,GLUE2GroupID=resource,o=glue";
83
84 # Now start outputting LDIF lines for the Manager object.
85 # Note that once we get here we are committed to printing a
86 # complete, valid object. Start with the DN ...
87
88 print "dn: GLUE2ManagerId=$ManagerId,$bind_dn\n";
89
90 # Print the boilerplate objectclass declarations and unique ID
91
92 print "objectClass: GLUE2Entity\n";
93 print "objectClass: GLUE2Manager\n";
94 print "objectClass: GLUE2ComputingManager\n";
95
96 # Times are mandated to be UTC only
97 my $TimeNow = strftime("%Y-%m-%dT%H:%M:%SZ", gmtime());
98 print "GLUE2EntityCreationTime: $TimeNow\n";
99
100 # No validity, since this is static info
101
102 # Manager Id
103 print "GLUE2ManagerID: $ManagerId\n";
104
105 # The name is just an indicative human-readable string.
106 print "GLUE2EntityName: Computing Manager on $host\n";
107
108 # Embed some metadata to help with debugging
109
110 print "GLUE2EntityOtherInfo: InfoProviderName=glite-ce-glue2-manager-static\n";
111 print "GLUE2EntityOtherInfo: InfoProviderVersion=$version\n";
112 print "GLUE2EntityOtherInfo: InfoProviderHost=$host\n";
113
114 # ProductName
115 my $GLUE2ManagerProductName = $config{CE_BATCH_SYS};
116
117 # No leading and traling spaces. No "
118 $GLUE2ManagerProductName =~ s/^\s+//;
119 $GLUE2ManagerProductName =~ s/\s+$//;
120 $GLUE2ManagerProductName =~ s/\"//g;
121
122 print "GLUE2ManagerProductName: $GLUE2ManagerProductName\n";
123
124 # ProductVersion
125 my $GLUE2ManagerProductVersion = $config{BATCH_VERSION};
126
127 # No leading and traling spaces. No "
128 $GLUE2ManagerProductVersion =~ s/^\s+//;
129 $GLUE2ManagerProductVersion =~ s/\s+$//;
130 $GLUE2ManagerProductVersion =~ s/\"//g;
131
132 print "GLUE2ManagerProductVersion: $GLUE2ManagerProductVersion\n";
133
134
135
136 # Finally print the upward link to the parent Service
137 print "GLUE2ManagerServiceForeignKey: $ServiceID\n";
138 print "GLUE2ComputingManagerComputingServiceForeignKey: $ServiceID\n";
139
140 # Print a newline to finish the object
141 print "\n";
142
143 exit 0;
144

Properties

Name Value
svn:executable *

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28