Stop writing useless files.

Bug #1541258 reported by Robert Bruce Park on 2016-02-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone
CI Train [cu2d]
Fix Released
Brian Murray

Bug Description

Ok, so the train is currently experiencing an impedence mismatch of sorts. One part of the code is writing a file to disk, and another part of the code is reading that value back and using it. This was written this way originally because those two parts of the code used to be called a drastically different times, and the files preserved in between.

Currently the files are no longer preserved in between and the value is written then instantly read back. It's pointless and the files should no longer be written to disk.

Start here:

In Archive.archive_pocket(), the call to self.send_file should be replaced with something simple like "self.published = version"

With that gone, "set_file" no longer has any callers and can be removed from here:

(also remove get_file as that already doesn't have any callers)

Then, the next problem you'll have is that you need to access those values from SiloState.published_versions, but SiloState doesn't contain references to the build objects. So somewhere in you'll need to write a method that iterates over the builds and returns the necessary dict. So probably something like:

for build in self.builds:
    versions[][] = build.version

(same defaultdict magic as the current SiloState.published_versions method).

Manager class has a reference to the SiloState instance so from there it should be easy to pass that value in where it needs to go. Bonus points if you eliminate SiloState.published_versions property entirely and let it pass-through to the underlying __getattr__ magic which gets added to the db directly.

Just don't forget that "published_versions" (the db field) is a string field, so you have to submit it as a JSON string, not as the actual object, eg {"published_versions": "{}"} is correct but {"published_versions": {}} is not.

Basically what it boils down to is that the existing SiloState.published_versions method will need to be mostly moved into the Manager class.

Hope that makes sense, if you have any questions I'll be online at 16:00 UTC.

Related branches

Changed in cupstream2distro:
assignee: nobody → Brian Murray (brian-murray)
description: updated
Changed in cupstream2distro:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers