def log_commons_version(self): """Report version of commons for pod's forgerock product.""" logger.debug('Report commons version for {name}:{commons_jar}'.format( name=self.name, commons_jar=DSPod.REPRESENTATIVE_COMMONS_JAR)) test_temp = os.path.join(DSPod.LOCAL_TEMP, self.name) test_file_path = os.path.join(test_temp, DSPod.REPRESENTATIVE_COMMONS_JAR) assert os.path.isfile(test_file_path), 'Failed to find {path}'.format( path=test_file_path) explode_directory = os.path.join(test_temp, DSPod.REPRESENTATIVE_COMMONS_JAR_NAME) with zipfile.ZipFile(test_file_path) as commons_zip_file: commons_zip_file.extractall(explode_directory) test_jar_properties_path = os.path.join( explode_directory, 'META-INF', 'maven', 'org.forgerock.commons', DSPod.REPRESENTATIVE_COMMONS_JAR_NAME, 'pom.properties') logger.debug('Checking commons version in {path}'.format( path=test_jar_properties_path)) assert os.path.isfile( test_jar_properties_path), 'Failed to find {path}'.format( path=test_jar_properties_path) with open(test_jar_properties_path) as file_pointer: lines = file_pointer.readlines() attributes_of_interest = {'version', 'groupId', 'artifactId'} os_metadata = Pod.get_metadata_of_interest('Commons', self.name, lines, attributes_of_interest) Pod.print_table(os_metadata)
def __init__(self, name, manifest_filepath): """ :param name: Pod name :param manifest_filepath: Path to product manifest file """ Pod.__init__(self, AMPod.PRODUCT_TYPE, name, manifest_filepath)
def log_commons_version(self): """Report version of commons for pod's forgerock product.""" logger.debug('Check commons version for {name}:{commons_jar}'.format( name=self.name, commons_jar=AmsterPod.REPRESENTATIVE_COMMONS_JAR)) test_temp = os.path.join(AmsterPod.LOCAL_TEMP, self.name) stdout, ignored = kubectl.exec(Pod.NAMESPACE, [ self.name, '-c', self.product_type, '--', 'find', AmsterPod.ROOT, '-name', 'amster-*.jar' ]) amster_filepath = stdout[0] head, tail = os.path.split( amster_filepath) # get versioned amster jar name exploded_directory = os.path.join(test_temp, 'exploded') amster_jar_filepath = os.path.join(test_temp, tail) with zipfile.ZipFile(amster_jar_filepath) as commons_zip_file: commons_zip_file.extractall(exploded_directory) test_jar_properties_path = os.path.join( exploded_directory, 'META-INF', 'maven', 'org.forgerock.commons', AmsterPod.REPRESENTATIVE_COMMONS_JAR_NAME, 'pom.properties') logger.debug('Checking commons version in {path}'.format( path=test_jar_properties_path)) assert os.path.isfile( test_jar_properties_path), 'Failed to find {path}'.format( path=test_jar_properties_path) with open(test_jar_properties_path) as file_pointer: lines = file_pointer.readlines() attribute_of_interest = {'version', 'groupId', 'artifactId'} os_metadata = Pod.get_metadata_of_interest('Commons', self.name, lines, attribute_of_interest) Pod.print_table(os_metadata)
def __init__(self, name, manifest_filepath): """ :param name: Pod name :param manifest_filepath: Path to product manifest file """ Pod.__init__(self, AmsterPod.PRODUCT_TYPE, name, manifest_filepath) self.manifest['amster_jvm'] = self.config[self.product_type]['amster_jvm']
def log_jdk(self): """Report Java version on the pod.""" logger.debug('Report Java version for {name}'.format(name=self.name)) metadata, ignored = kubectl.exec( Pod.NAMESPACE, [self.name, '-c', self.product_type, '--', 'bin/start-ds', '-s']) attribute_of_interest = {'JAVA Version', 'JAVA Vendor', 'JVM Version'} os_metadata = Pod.get_metadata_of_interest('JAVA', self.name, metadata, attribute_of_interest) Pod.print_table(os_metadata)
def is_expected_jdk(self, namespace): """ Return True if jdk is as expected, otherwise assert. :param namespace The kubernetes namespace. :return: True if jdk is as expected """ return Pod.is_expected_jdk( self, namespace, ' '.join(['-c openidm', '-- java -version']))
def version(self): """ Return the product version information. :return: Dictionary """ logger.debug('Get version for {name}'.format(name=self.name)) stdout, ignored = kubectl.exec( Pod.NAMESPACE, [self.name, '-c', self.product_type, '--', 'bin/start-ds', '-F']) logger.debug('{name} {product_type}: {version}'.format( name=self.name, product_type=self.product_type, version=stdout[0])) attribute_of_interest = { 'Build ID', 'Major Version', 'Minor Version', 'Point Version' } return Pod.get_metadata_of_interest('Version', self.name, stdout, attribute_of_interest)
def version(self): """ Return the product version information. :return: Dictionary """ logger.test_step( 'Report IG version for pod {name}'.format(name=self.name)) test_jar_properties_path = os.path.join(IGPod.ROOT, 'webapps', 'ROOT', 'META-INF', 'maven', 'org.forgerock.openig', 'openig-war', 'pom.properties') attributes_of_interest = {'version', 'groupId', 'artifactId'} metadata, ignored = kubectl.exec(Pod.NAMESPACE, [ self.name, '-c', self.product_type, '--', 'cat', test_jar_properties_path ]) version_metadata = Pod.get_metadata_of_interest( self.product_type, self.name, metadata, attributes_of_interest) return version_metadata