Skip to content

Commit

Permalink
Merge pull request #48 from ARGOeu/devel
Browse files Browse the repository at this point in the history
devel to master
  • Loading branch information
skanct committed Jun 30, 2015
2 parents 23982bc + 1a18516 commit 9696da5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
7 changes: 5 additions & 2 deletions argo-egi-connectors.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: argo-egi-connectors
Version: 1.4.1
Release: 5%{?dist}
Version: 1.4.2
Release: 1%{?dist}

Group: EGI/SA4
License: ASL 2.0
Expand Down Expand Up @@ -45,6 +45,9 @@ rm -rf $RPM_BUILD_ROOT
%attr(0750,root,root) %dir %{_localstatedir}/log/argo-egi-connectors/

%changelog
* Tue Jun 23 2015 Daniel Vrcic <[email protected]> - 1.4.2-1%{?dist}
- changed internal parser structure to address entities with doubled scope
https://github.com/ARGOeu/ARGO/issues/141
* Tue Jun 2 2015 Daniel Vrcic <[email protected]> - 1.4.1-5%{?dist}
- new path and filename for consumer logs
* Thu May 28 2015 Daniel Vrcic <[email protected]> - 1.4.1-4%{?dist}
Expand Down
43 changes: 22 additions & 21 deletions bin/topology-gocdb-connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ def __init__(self, feed):
self.gocdbHost = self._getHostFeed(feed)
self.hostKey = globopts['AuthenticationHostKey'.lower()]
self.hostCert = globopts['AuthenticationHostCert'.lower()]
self.siteList = dict()
self.serviceList = dict()
self.groupList = dict()
self.siteListEGI, self.siteListLocal = dict(), dict()
self.serviceListEGI, self.serviceListLocal = dict(), dict()
self.groupListEGI, self.groupListLocal = dict(), dict()

def _getHostFeed(self, feed):
host = feed
Expand All @@ -62,18 +62,18 @@ def getGroupOfServices(self):
self.loadDataIfNeeded()

groups = list()
for key, group in self.groupList.iteritems():
for d in self.groupListEGI, self.groupListLocal:
key, group = d.iteritems()
for service in group['services']:

g = dict()
g['type'] = fetchtype.upper()
g['group'] = group['name']
g['service'] = service['type']
g['hostname'] = service['hostname']
g['group_monitored'] = group['monitored']
g['tags'] = {'scope' : group['scope'], \
'monitored' : 1 if service['monitored'] == "Y" else 0, \
'production' : 1 if service['production'] == "Y" else 0}
'monitored' : 1 if service['monitored'] == "Y" else 0, \
'production' : 1 if service['production'] == "Y" else 0}
groups.append(g)

return groups
Expand All @@ -84,17 +84,18 @@ def getGroupOfGroups(self):
groupofgroups = list()

if fetchtype == "ServiceGroups":
for key, value in self.groupList.iteritems():
for d in self.groupListEGI, self.groupListLocal:
key, value = d.iteritems()
g = dict()
g['type'] = 'PROJECT'
g['group'] = 'EGI'
g['subgroup'] = value['name']
g['tags'] = {'monitored' : 1 if value['monitored'] == 'Y' else 0, \
g['tags'] = {'monitored' : 1 if value['monitored'] == 'Y' else 0,
'scope' : value['scope']}
groupofgroups.append(g)
else:
gg = sorted([value for key, value in self.siteList.iteritems()], \
key=lambda s: s['ngi'])
gg = sorted([value for d in self.siteListEGI, self.siteListLocal for key, value in d.iteritems()],
key=lambda s: s['ngi'])

for gr in gg:
g = dict()
Expand All @@ -113,7 +114,7 @@ def getGroupOfEndpoints(self):
self.loadDataIfNeeded()

groupofendpoints = list()
ge = sorted([value for key, value in self.serviceList.iteritems()], \
ge = sorted([value for d in self.serviceListEGI, self.serviceListLocal for key, value in d.iteritems()],
key=lambda s: s['site'])

for gr in ge:
Expand All @@ -130,17 +131,17 @@ def getGroupOfEndpoints(self):
return groupofendpoints

def loadDataIfNeeded(self):
if len(self.siteList) == 0:
self.getSitesInternal(self.siteList, 'EGI')
self.getSitesInternal(self.siteList, 'Local')
if len(self.siteListEGI) == 0:
self.getSitesInternal(self.siteListEGI, 'EGI')
self.getSitesInternal(self.siteListLocal, 'Local')

if len(self.serviceList) == 0:
self.getServiceEndpoints(self.serviceList, 'EGI')
self.getServiceEndpoints(self.serviceList, 'Local')
if len(self.serviceListEGI) == 0:
self.getServiceEndpoints(self.serviceListEGI, 'EGI')
self.getServiceEndpoints(self.serviceListLocal, 'Local')

if len(self.groupList) == 0:
self.getServiceGroups(self.groupList, 'EGI')
self.getServiceGroups(self.groupList, 'Local')
if len(self.groupListEGI) == 0:
self.getServiceGroups(self.groupListEGI, 'EGI')
self.getServiceGroups(self.groupListLocal, 'Local')

def getServiceEndpoints(self, serviceList, scope):
urlFile = urllib.urlopen(self.gocdbUrl + '/public/?method=get_service_endpoint&scope=' + scope)
Expand Down

0 comments on commit 9696da5

Please sign in to comment.