From ea30f55e18c2d4a96e37cc2e14b6222592a36023 Mon Sep 17 00:00:00 2001 From: John-Paul Navarro Date: Tue, 5 Jan 2021 11:48:47 -0600 Subject: [PATCH] See CHANGELOG tag-1.0-20210105 --- CHANGELOG | 3 +++ bin/route_resource_v3.py | 42 ++++++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a6f21df..496be99 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +tag-1.0-20210105 JP + - Format Description additions as lists + tag-1.0-20201223 JP - Generate full Description and no ShortDescription - Implement Description construction and html rendering class diff --git a/bin/route_resource_v3.py b/bin/route_resource_v3.py index 38c1ce9..1107207 100755 --- a/bin/route_resource_v3.py +++ b/bin/route_resource_v3.py @@ -94,7 +94,9 @@ def append(self, value): self.value = clean_value else: self.value += '\n{}'.format(clean_value) - def html(self, ID=None): + def blank_line(self): # Forced blank line used to start a markup list + self.value += '\n' + def html(self, ID=None): # If an ID is provided, log it to record what resource had the warnings if self.value is None: return(None) output = formatter(self.value, filter_name='restructuredtext', settings_overrides=self.markup_settings) @@ -203,7 +205,7 @@ def Setup(self, peak_sleep=10, offpeak_sleep=60, max_stale=24 * 60): # Connect Elasticsearch if 'ELASTIC_HOSTS' in self.config: - self.logger.info('Warehouse elastichost={}'.format(self.config['ELASTIC_HOSTS'])) + self.logger.critical('Warehouse elastichost={}'.format(self.config['ELASTIC_HOSTS'])) self.ESEARCH = elasticsearch_dsl.connections.create_connection( \ hosts = self.config['ELASTIC_HOSTS'], \ connection_class = RequestsHttpConnection, \ @@ -570,9 +572,10 @@ def Write_RSP_Support_Providers(self, content, contype, config): try: ShortDescription = None Description = Format_Description(item.get('Description')) + Description.blank_line() for c in ['ContactURL', 'ContactEmail', 'ContactPhone']: if c in item and item[c] is not None and item[c] is not '': - Description.append(' {} is {}'.format(c, item[c])) + Description.append('- {} is {}'.format(c, item[c])) # if not bool(BeautifulSoup(Description, "html.parser").find()): # Test for pre-existing HTML resource = ResourceV3( ID = myGLOBALURN, @@ -821,10 +824,11 @@ def Write_RSP_Vendor_Software(self, content, contype, config): try: ShortDescription = None Description = Format_Description(item.get('Description')) + Description.blank_line() if item.get('VendorSoftwareURL'): - Description.append('Vendor Software URL: ' + item.get('VendorSoftwareURL')) + Description.append('- Vendor Software URL: ' + item.get('VendorSoftwareURL')) if item.get('RelatedDiscussionForums'): - Description.append('Related Discussion Forum: ' + item.get('RelatedDiscussionForums')) + Description.append('- Related Discussion Forum: ' + item.get('RelatedDiscussionForums')) # if not bool(BeautifulSoup(Description, "html.parser").find()): # Test for pre-existing HTML resource = ResourceV3( ID = myGLOBALURN, @@ -925,14 +929,15 @@ def Write_RSP_Network_Service(self, content, contype, config): try: ShortDescription = None Description = Format_Description(item.get('Description') or item.get('Title') or None) + Description.blank_line() if item.get('NetworkServiceEndpoints'): - Description.append('Service Access URL: {}'.format(item.get('NetworkServiceEndpoints'))) + Description.append('- Service Access URL: {}'.format(item.get('NetworkServiceEndpoints'))) if item.get('UserDocumentationURL'): - Description.append('Service Documentation: {}'.format(item.get('UserDocumentationURL'))) + Description.append('- Service Documentation: {}'.format(item.get('UserDocumentationURL'))) if item.get('VendorSoftwareURL') and item.get('NetworkServiceEndpoints') and item.get('VendorSoftwareURL') != item.get('NetworkServiceEndpoints'): - Description.append('Vendor Software URL: {}'.format(item.get('VendorSoftwareURL'))) + Description.append('- Vendor Software URL: {}'.format(item.get('VendorSoftwareURL'))) if item.get('VendorURL') and item.get('VendorSoftwareURL') and item.get('VendorURL') != item.get('VendorSoftwareURL'): - Description.append('Vendor URL: {}'.format(item.get('VendorURL'))) + Description.append('- Vendor URL: {}'.format(item.get('VendorURL'))) # if not bool(BeautifulSoup(Description, "html.parser").find()): # Test for pre-existing HTML resource = ResourceV3( ID = myGLOBALURN, @@ -1049,10 +1054,11 @@ def Write_Glue2_Network_Service(self, content, contype, config): try: ShortDescription = None + Description.blank_line() if item.get('URL'): - Description.append('Service URL: {}'.format(item.get('URL'))) + Description.append('- Service URL: {}'.format(item.get('URL'))) try: - Description.append('Running on {} ({})'.format(self.HPCRESOURCE_INFO[item['ResourceID']]['Name'], item['ResourceID'])) + Description.append('- Running on {} ({})'.format(self.HPCRESOURCE_INFO[item['ResourceID']]['Name'], item['ResourceID'])) except: pass # if not bool(BeautifulSoup(Description, "html.parser").find()): # Test for pre-existing HTML @@ -1151,14 +1157,15 @@ def Write_RSP_Executable_Software(self, content, contype, config): try: ShortDescription = (item.get('VendorCommonName') or item.get('Title') or '').strip() Description = Format_Description(item.get('Description')) + Description.blank_line() if item.get('NetworkServiceEndpoints'): - Description.append('Service URL: {}'.format(item.get('NetworkServiceEndpoints'))) + Description.append('- Service URL: {}'.format(item.get('NetworkServiceEndpoints'))) if item.get('UserDocumentationURL'): - Description.append('Service Documentation: {}'.format(item.get('UserDocumentationURL'))) + Description.append('- Service Documentation: {}'.format(item.get('UserDocumentationURL'))) if item.get('VendorSoftwareURL','') != item.get('NetworkServiceEndpoints', ''): - Description.append('Vendor Product URL: {}'.format(item.get('VendorSoftwareURL'))) + Description.append('- Vendor Product URL: {}'.format(item.get('VendorSoftwareURL'))) if item.get('VendorURL','') != item.get('VendorSoftwareURL', ''): - Description.append('Vendor URL: {}'.format(item.get('VendorURL'))) + Description.append('- Vendor URL: {}'.format(item.get('VendorURL'))) # if not bool(BeautifulSoup(Description, "html.parser").find()): # Test for pre-existing HTML resource = ResourceV3( ID = myGLOBALURN, @@ -1368,12 +1375,13 @@ def Write_RSP_Packaged_Software(self, content, contype, config): if TargetAudience: Description.append('For target audience: {}'.format(TargetAudience)) PackageURL = item.get('PackageURL') + Description.blank_line() if PackageURL: PackageFormat = '({})'.format(item.get('PackageFormat')) if item.get('PackageFormat') else '' - Description.append('Package {} URL: {}'.format(PackageFormat, PackageURL)) + Description.append('- Package {} URL: {}'.format(PackageFormat, PackageURL)) ProvisioningInstructionsURL = item.get('ProvisioningInstructionsURL') if ProvisioningInstructionsURL: - Description.append('Installation Instructions: {}'.format(ProvisioningInstructionsURL)) + Description.append('- Installation Instructions: {}'.format(ProvisioningInstructionsURL)) # if not bool(BeautifulSoup(Description, "html.parser").find()): # Test for pre-existing HTML resource = ResourceV3( ID = myGLOBALURN,