Skip to content

Commit 546e17a

Browse files
committed
For ETM/QM, projects configured for SINGLE (baselines enabled) are now treated as opt-out (better than dying with an exception, don't know how to find the baselines using a public API)
1 parent 2bdc6b7 commit 546e17a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+15366
-15364
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.25.0
2+
current_version = 0.26.0
33
commit = True
44
tag = True
55

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
SPDX-License-Identifier: MIT
1010

11-
version="0.25.0"
11+
version="0.26.0"
1212

1313
What's New?
1414
===========

elmclient/__meta__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
app = 'elmoslcquery'
1111
description = 'Commandline OSLC query for ELM'
12-
version = '0.25.0'
12+
version = '0.26.0'
1313
license = 'MIT'
1414
author_name = 'Ian Barnard'
1515
author_mail = 'ian.barnard@uk.ibm.com'

elmclient/_qm.py

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ def load_components_and_configurations(self,force=False):
5555
# for QM, no configs to load!
5656
return
5757
elif self.singlemode:
58+
59+
# xmlns:ns3="http://open-services.net/ns/core#
60+
# <ns3:details ns4:resource="https://jazz.ibm.com:9443/qm/process/project-areas/_AzVy8LOJEe6f6NR46ab0Iw"/>
5861
logger.debug( f"{self.singlemode=}" )
62+
self.singlemode=False
63+
self.is_optin=False
64+
return
5965
#get the single component from a QueryCapability
6066
# <oslc:QueryCapability>
6167
# <oslc_config:component rdf:resource="https://mb02-calm.rtp.raleigh.ibm.com:9443/rm/cm/component/_ln_roBIOEeumc4tx0skHCA"/>
@@ -68,9 +74,8 @@ def load_components_and_configurations(self,force=False):
6874

6975
sx = self.get_services_xml()
7076
assert sx is not None, "sx is None"
71-
compuri = rdfxml.xmlrdf_get_resource_uri(sx, ".//oslc:QueryCapability/oslc_config:component")
77+
compuri = rdfxml.xmlrdf_get_resource_uri(sx, ".//oslc:details")
7278
assert compuri is not None, "compuri is None"
73-
7479
ncomps += 1
7580
self._components[compuri] = {'name': self.name, 'configurations': {}, 'confs_to_load': []}
7681
configs = self.execute_get_xml( compuri+"/configurations", intent="Retrieve all project/component configurations (singlemode)" )
@@ -469,6 +474,43 @@ def _get_headers(self, headers=None):
469474
result.update(headers)
470475
return result
471476

477+
# load the projects from the project areas XML - doesn't create any project classes, this is done later when finding a project to open
478+
# this is specific to QM so that projects enabled for baselines are treated as opt-out (which means you can't query baselines!)
479+
def _load_projects(self,include_archived=False,force=False):
480+
if self.project_class is None:
481+
raise Exception(f"projectClass has not been set on {self}!")
482+
if self._projects is not None and not force:
483+
return
484+
logger.info( "Loading projects")
485+
self._projects = {}
486+
uri = rdfxml.xmlrdf_get_resource_uri(self.rootservices_xml, 'jp06:projectAreas')
487+
params = {}
488+
if include_archived:
489+
params['includeArchived'] = 'true'
490+
self.project_areas_xml = self.execute_get_xml(uri, params=params, intent="Retrieve all project area definitions" )
491+
logger.debug( f"{self.project_areas_xml=}" )
492+
for projectel in rdfxml.xml_find_elements(self.project_areas_xml,".//jp06:project-area" ):
493+
logger.debug( f"{projectel=}" )
494+
projectu = rdfxml.xmlrdf_get_resource_text(projectel,".//jp06:url")
495+
projectname = rdfxml.xmlrdf_get_resource_uri(projectel,attrib='jp06:name')
496+
logger.debug( f"{projectname=}" )
497+
is_optin = False
498+
singlemode = False
499+
if self.supports_configs:
500+
en = rdfxml.xmlrdf_get_resource_text(projectel,'.//jp:configuration-management-enabled')
501+
is_optin = ( rdfxml.xmlrdf_get_resource_text(projectel,'.//jp:configuration-management-enabled') == "true" )
502+
singlemode = ( rdfxml.xmlrdf_get_resource_text(projectel,'.//jp:configuration-management-mode') == "SINGLE" )
503+
if singlemode:
504+
# for QM, treat opt-in SINGLE as opt-out
505+
is_optin = False
506+
singlemode = False
507+
logger.info( f"{projectname=} {projectu=} {is_optin=} {singlemode=}" )
508+
509+
self._projects[projectu] = {'name':projectname, 'project': None, 'projectu': projectu, 'is_optin': is_optin, 'singlemode': singlemode }
510+
self._projects[projectname] = projectu
511+
512+
513+
472514
# load the typesystem using the OSLC shape resources listed for all the creation factories and query capabilities
473515
def load_types(self, force=False):
474516
self._load_types(force)

elmclient/_queryparser.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,6 @@ def invalue(self, s):
482482
def string_esc(self, s):
483483
logger.info( f"string_esc {s} returning {s[0].value}" )
484484
# print( f"{s=}" )
485-
# burp
486485
return s[0].value # string literals include double quotes in the value
487486

488487
def typedliteralstring(self, s):

elmclient/examples/log2seq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def decodemessage(msg):
184184
response = {'status': None,'headers':[], 'body':None, 'action':None }
185185
parts = re.search( r"\n*(?:INTENT: ([^\n]*?)\n+)?(?:(?:(GET|PUT|POST|HEAD|DELETE|POST) +(\S+)\n((?: +.*?\n)+)\n*)(?::+?=\n(.*?)\n-+?=\n)?.*?\n+Response: (\d+?)\n( .*?)\n\n(?::+?@\n(.*?)\n-+?@\n+)?)?(?:ACTION: (.*?)\n)?",msg, flags=re.DOTALL )
186186
if parts.group(0) == '':
187-
burp
187+
raise Exception( "formatting wrong!" )
188188
# for l,g in enumerate(parts.groups()):
189189
# print( f"{l=} {g=}" )
190190
request['intent'] = parts.group(1)

elmclient/oslcqueryapi.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,6 @@ def _execute_vanilla_oslc_query(self, querycapabilityuri, query_params, orderby=
814814
# print( f"{desc=}" )
815815
# print( f"{ET.tostring(desc)=}" )
816816
# print( "\n" )
817-
# burp
818817
pass
819818
if desc is not None:
820819
# for an entry with no children, if dup and value is same then ignore it

0 commit comments

Comments
 (0)