Skip to content

Commit

Permalink
Fix some dependency rot and metadata creation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wiggzz committed Oct 22, 2020
1 parent 6ef90d8 commit 3bec308
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.0
3.8.6
16 changes: 11 additions & 5 deletions olm/versioning/collect_csvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,23 @@

tar = tarfile.open(fileobj=io.BytesIO(response.content), mode='r')

bundle_member = [member for member in tar.getmembers() if 'bundle.yaml' in member.name][0]
possible_bundle_members = [member for member in tar.getmembers() if 'bundle.yaml' in member.name]

bundle = tar.extractfile(bundle_member)
if (len(possible_bundle_members) > 0):
bundle_member = possible_bundle_members[0]

data = yaml.load(bundle, Loader=yaml.SafeLoader)
bundle = tar.extractfile(bundle_member)

csv_bundles = yaml.load_all(data['data']['clusterServiceVersions'], Loader=yaml.SafeLoader)
data = yaml.load(bundle, Loader=yaml.SafeLoader)

csv_bundles = yaml.load_all(data['data']['clusterServiceVersions'], Loader=yaml.SafeLoader)
else:
csv_bundles = [yaml.load(tar.extractfile(member),Loader=yaml.SafeLoader) for member in tar.getmembers() if 'clusterserviceversion.yaml' in member.name]

for csv_bundle in csv_bundles:
for csv in csv_bundle:
csvs_by_version[csv['spec']['version']] = csv
if isinstance(csv, dict):
csvs_by_version[csv['spec']['version']] = csv


ordered_csvs = sorted(csvs_by_version.values(), key=lambda csv: semver.VersionInfo.parse(csv['spec']['version']))
Expand Down
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<surefire-plugin.version>2.22.0</surefire-plugin.version>
<quarkus.version>1.2.1.Final</quarkus.version>
<bouncycastle.version>1.62</bouncycastle.version>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
Expand All @@ -38,6 +39,12 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-kubernetes-client</artifactId>
</dependency>
<!-- This is an "optional" dependency, but is required to create the default KubernetesClient -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-reactive-streams-operators</artifactId>
Expand Down

0 comments on commit 3bec308

Please sign in to comment.