Skip to content

Commit

Permalink
For ETM/QM, projects configured for SINGLE (baselines enabled) are no…
Browse files Browse the repository at this point in the history
…w treated as opt-out (better than dying with an exception, don't know how to find the baselines using a public API)
  • Loading branch information
barny committed Jan 16, 2024
1 parent 2bdc6b7 commit 546e17a
Show file tree
Hide file tree
Showing 66 changed files with 15,366 additions and 15,364 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.25.0
current_version = 0.26.0
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

SPDX-License-Identifier: MIT

version="0.25.0"
version="0.26.0"

What's New?
===========
Expand Down
2 changes: 1 addition & 1 deletion elmclient/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

app = 'elmoslcquery'
description = 'Commandline OSLC query for ELM'
version = '0.25.0'
version = '0.26.0'
license = 'MIT'
author_name = 'Ian Barnard'
author_mail = 'ian.barnard@uk.ibm.com'
Expand Down
46 changes: 44 additions & 2 deletions elmclient/_qm.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ def load_components_and_configurations(self,force=False):
# for QM, no configs to load!
return
elif self.singlemode:

# xmlns:ns3="http://open-services.net/ns/core#
# <ns3:details ns4:resource="https://jazz.ibm.com:9443/qm/process/project-areas/_AzVy8LOJEe6f6NR46ab0Iw"/>
logger.debug( f"{self.singlemode=}" )
self.singlemode=False
self.is_optin=False
return
#get the single component from a QueryCapability
# <oslc:QueryCapability>
# <oslc_config:component rdf:resource="https://mb02-calm.rtp.raleigh.ibm.com:9443/rm/cm/component/_ln_roBIOEeumc4tx0skHCA"/>
Expand All @@ -68,9 +74,8 @@ def load_components_and_configurations(self,force=False):

sx = self.get_services_xml()
assert sx is not None, "sx is None"
compuri = rdfxml.xmlrdf_get_resource_uri(sx, ".//oslc:QueryCapability/oslc_config:component")
compuri = rdfxml.xmlrdf_get_resource_uri(sx, ".//oslc:details")
assert compuri is not None, "compuri is None"

ncomps += 1
self._components[compuri] = {'name': self.name, 'configurations': {}, 'confs_to_load': []}
configs = self.execute_get_xml( compuri+"/configurations", intent="Retrieve all project/component configurations (singlemode)" )
Expand Down Expand Up @@ -469,6 +474,43 @@ def _get_headers(self, headers=None):
result.update(headers)
return result

# load the projects from the project areas XML - doesn't create any project classes, this is done later when finding a project to open
# this is specific to QM so that projects enabled for baselines are treated as opt-out (which means you can't query baselines!)
def _load_projects(self,include_archived=False,force=False):
if self.project_class is None:
raise Exception(f"projectClass has not been set on {self}!")
if self._projects is not None and not force:
return
logger.info( "Loading projects")
self._projects = {}
uri = rdfxml.xmlrdf_get_resource_uri(self.rootservices_xml, 'jp06:projectAreas')
params = {}
if include_archived:
params['includeArchived'] = 'true'
self.project_areas_xml = self.execute_get_xml(uri, params=params, intent="Retrieve all project area definitions" )
logger.debug( f"{self.project_areas_xml=}" )
for projectel in rdfxml.xml_find_elements(self.project_areas_xml,".//jp06:project-area" ):
logger.debug( f"{projectel=}" )
projectu = rdfxml.xmlrdf_get_resource_text(projectel,".//jp06:url")
projectname = rdfxml.xmlrdf_get_resource_uri(projectel,attrib='jp06:name')
logger.debug( f"{projectname=}" )
is_optin = False
singlemode = False
if self.supports_configs:
en = rdfxml.xmlrdf_get_resource_text(projectel,'.//jp:configuration-management-enabled')
is_optin = ( rdfxml.xmlrdf_get_resource_text(projectel,'.//jp:configuration-management-enabled') == "true" )
singlemode = ( rdfxml.xmlrdf_get_resource_text(projectel,'.//jp:configuration-management-mode') == "SINGLE" )
if singlemode:
# for QM, treat opt-in SINGLE as opt-out
is_optin = False
singlemode = False
logger.info( f"{projectname=} {projectu=} {is_optin=} {singlemode=}" )

self._projects[projectu] = {'name':projectname, 'project': None, 'projectu': projectu, 'is_optin': is_optin, 'singlemode': singlemode }
self._projects[projectname] = projectu



# load the typesystem using the OSLC shape resources listed for all the creation factories and query capabilities
def load_types(self, force=False):
self._load_types(force)
Expand Down
1 change: 0 additions & 1 deletion elmclient/_queryparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,6 @@ def invalue(self, s):
def string_esc(self, s):
logger.info( f"string_esc {s} returning {s[0].value}" )
# print( f"{s=}" )
# burp
return s[0].value # string literals include double quotes in the value

def typedliteralstring(self, s):
Expand Down
2 changes: 1 addition & 1 deletion elmclient/examples/log2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def decodemessage(msg):
response = {'status': None,'headers':[], 'body':None, 'action':None }
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 )
if parts.group(0) == '':
burp
raise Exception( "formatting wrong!" )
# for l,g in enumerate(parts.groups()):
# print( f"{l=} {g=}" )
request['intent'] = parts.group(1)
Expand Down
1 change: 0 additions & 1 deletion elmclient/oslcqueryapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,6 @@ def _execute_vanilla_oslc_query(self, querycapabilityuri, query_params, orderby=
# print( f"{desc=}" )
# print( f"{ET.tostring(desc)=}" )
# print( "\n" )
# burp
pass
if desc is not None:
# for an entry with no children, if dup and value is same then ignore it
Expand Down
Loading

0 comments on commit 546e17a

Please sign in to comment.