Skip to content

Commit 652b551

Browse files
committed
Drop unused options (SOFTWARE-3471)
- SiteInformation.city (OSG_SITE_CITY) - SiteInformation.country (OSG_SITE_COUNTRY) - SiteInformation.latitude (OSG_SITE_LATITUDE) - SiteInformation.longitude (OSG_SITE_LONGITUDE)
1 parent fc05544 commit 652b551

File tree

3 files changed

+8
-145
lines changed

3 files changed

+8
-145
lines changed

config/40-siteinfo.ini

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,3 @@ resource = UNAVAILABLE
2929
; Set "site_policy" to a URL that lists your site's usage policy (if there
3030
; is such a URL).
3131
;site_policy = UNAVAILABLE
32-
33-
; Set "city" to the city that the cluster is located in.
34-
;
35-
; YOU WILL NEED TO CHANGE THIS
36-
city = UNAVAILABLE
37-
38-
; Set "country" to the country that the cluster is located in.
39-
;
40-
; YOU WILL NEED TO CHANGE THIS
41-
country = UNAVAILABLE
42-
43-
; Set "longitude" to the longitude of the cluster's location.
44-
; Accepted values are between -180 (west) and 180 (east).
45-
; If you are in the US, this will be negative.
46-
;
47-
; YOU WILL NEED TO CHANGE THIS
48-
longitude = UNAVAILABLE
49-
50-
; Set "latitude" to the latitude of the cluster's location.
51-
; Accepted values are between -90 (south) and 90 (north).
52-
; If you are in the US, this will be positive.
53-
;
54-
; YOU WILL NEED TO CHANGE THIS
55-
latitude = UNAVAILABLE

osg_configure/configure_modules/siteinformation.py

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,6 @@ def __init__(self, *args, **kwargs):
4343
required=OPTIONAL,
4444
default_value='',
4545
mapping='OSG_SITE_INFO'),
46-
'city':
47-
configfile.Option(name='city',
48-
required=MANDATORY_ON_CE,
49-
mapping='OSG_SITE_CITY'),
50-
'country':
51-
configfile.Option(name='country',
52-
required=MANDATORY_ON_CE,
53-
mapping='OSG_SITE_COUNTRY'),
54-
'longitude':
55-
configfile.Option(name='longitude',
56-
opt_type=float,
57-
required=MANDATORY_ON_CE,
58-
mapping='OSG_SITE_LONGITUDE'),
59-
'latitude':
60-
configfile.Option(name='latitude',
61-
opt_type=float,
62-
required=MANDATORY_ON_CE,
63-
mapping='OSG_SITE_LATITUDE'),
6446
'resource':
6547
configfile.Option(name='resource',
6648
required=MANDATORY,
@@ -90,8 +72,12 @@ def parse_configuration(self, configuration):
9072

9173
self.get_options(configuration,
9274
ignore_options=[
75+
"city",
9376
"contact",
77+
"country",
9478
"email",
79+
"latitude",
80+
"longitude",
9581
])
9682
self.log('SiteInformation.parse_configuration completed')
9783

@@ -130,24 +116,6 @@ def check_attributes(self, attributes):
130116
section=self.config_section,
131117
level=logging.WARNING)
132118

133-
latitude = self.opt_val("latitude")
134-
if not utilities.blank(latitude) and not -90 <= latitude <= 90:
135-
self.log("Latitude must be between -90 and 90, got %s" %
136-
latitude,
137-
section=self.config_section,
138-
option='latitude',
139-
level=logging.ERROR)
140-
attributes_ok = False
141-
142-
longitude = self.opt_val("longitude")
143-
if not utilities.blank(longitude) and not -180 <= longitude <= 180:
144-
self.log("Longitude must be between -180 and 180, got %s" %
145-
longitude,
146-
section=self.config_section,
147-
option='longitude',
148-
level=logging.ERROR)
149-
attributes_ok = False
150-
151119
sponsor = self.opt_val("sponsor")
152120
if not utilities.blank(sponsor):
153121
attributes_ok &= self.check_sponsor(sponsor)

tests/test_siteattributes.py

Lines changed: 4 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ def testParsing1(self):
5555
'OSG_SITE_NAME': 'MY_SITE',
5656
'OSG_SPONSOR': 'osg:100',
5757
'OSG_SITE_INFO': 'http://example/com/policy.html',
58-
'OSG_SITE_CITY': 'Chicago',
59-
'OSG_SITE_COUNTRY': 'US',
60-
'OSG_SITE_LONGITUDE': '84.23',
61-
'OSG_SITE_LATITUDE': '23.32'}
58+
}
6259
for var in variables:
6360
self.assertTrue(var in attributes,
6461
"Attribute %s missing" % var)
@@ -88,10 +85,7 @@ def testParsing2(self):
8885
'OSG_SITE_NAME': 'MY_SITE',
8986
'OSG_SPONSOR': 'osg:50 usatlas:50',
9087
'OSG_SITE_INFO': 'http://example/com/policy.html',
91-
'OSG_SITE_CITY': 'Chicago',
92-
'OSG_SITE_COUNTRY': 'US',
93-
'OSG_SITE_LONGITUDE': '-84.23',
94-
'OSG_SITE_LATITUDE': '-23.32'}
88+
}
9589
for var in variables:
9690
self.assertTrue(var in attributes,
9791
"Attribute %s missing" % var)
@@ -121,10 +115,7 @@ def testParsing3(self):
121115
'OSG_SITE_NAME': 'MY_SITE',
122116
'OSG_SPONSOR': 'osg:50 usatlas:50',
123117
'OSG_SITE_INFO': 'http://example/com/policy.html',
124-
'OSG_SITE_CITY': 'Chicago',
125-
'OSG_SITE_COUNTRY': 'US',
126-
'OSG_SITE_LONGITUDE': '-84.23',
127-
'OSG_SITE_LATITUDE': '-23.32'}
118+
}
128119
for var in variables:
129120
self.assertTrue(var in attributes,
130121
"Attribute %s missing" % var)
@@ -152,11 +143,7 @@ def testMissingAttribute(self):
152143

153144
mandatory_on_all = ['group']
154145
# ^ TODO OSG 3.5: add "resource" to this list
155-
mandatory_on_ce = ['host_name',
156-
'city',
157-
'country',
158-
'longitude',
159-
'latitude']
146+
mandatory_on_ce = ['host_name']
160147
mandatory = list(mandatory_on_all)
161148
if ce_installed():
162149
mandatory += mandatory_on_ce
@@ -171,74 +158,6 @@ def testMissingAttribute(self):
171158
settings.parse_configuration,
172159
configuration)
173160

174-
def testInvalidLatitude(self):
175-
"""
176-
Test the check_attributes with invalid latitude values
177-
"""
178-
179-
config_file = get_test_config("siteattributes/" \
180-
"invalid_latitude1.ini")
181-
configuration = configparser.SafeConfigParser()
182-
configuration.read(config_file)
183-
184-
settings = siteinformation.SiteInformation(logger=global_logger)
185-
try:
186-
settings.parse_configuration(configuration)
187-
except Exception as e:
188-
self.fail("Received exception while parsing configuration: %s" % e)
189-
190-
attributes = settings.get_attributes()
191-
self.assertFalse(settings.check_attributes(attributes),
192-
"Invalid latitude ignored")
193-
194-
config_file = get_test_config("siteattributes/" \
195-
"invalid_latitude2.ini")
196-
configuration = configparser.SafeConfigParser()
197-
configuration.read(config_file)
198-
settings = siteinformation.SiteInformation(logger=global_logger)
199-
try:
200-
settings.parse_configuration(configuration)
201-
except Exception as e:
202-
self.fail("Received exception while parsing configuration: %s" % e)
203-
204-
attributes = settings.get_attributes()
205-
self.assertFalse(settings.check_attributes(attributes),
206-
"Invalid latitude ignored")
207-
208-
def testInvalidLongitude(self):
209-
"""
210-
Test the check_attributes with invalid longitude values
211-
"""
212-
213-
config_file = get_test_config("siteattributes/" \
214-
"invalid_longitude1.ini")
215-
configuration = configparser.SafeConfigParser()
216-
configuration.read(config_file)
217-
218-
settings = siteinformation.SiteInformation(logger=global_logger)
219-
try:
220-
settings.parse_configuration(configuration)
221-
except Exception as e:
222-
self.fail("Received exception while parsing configuration: %s" % e)
223-
224-
attributes = settings.get_attributes()
225-
self.assertFalse(settings.check_attributes(attributes),
226-
"Invalid latitude ignored")
227-
228-
config_file = get_test_config("siteattributes/" \
229-
"invalid_longitude2.ini")
230-
configuration = configparser.SafeConfigParser()
231-
configuration.read(config_file)
232-
settings = siteinformation.SiteInformation(logger=global_logger)
233-
try:
234-
settings.parse_configuration(configuration)
235-
except Exception as e:
236-
self.fail("Received exception while parsing configuration: %s" % e)
237-
238-
attributes = settings.get_attributes()
239-
self.assertFalse(settings.check_attributes(attributes),
240-
"Invalid latitude ignored")
241-
242161
def testInvalidHostname(self):
243162
"""
244163
Test the check_attributes with invalid hostname

0 commit comments

Comments
 (0)