Modify the code to validate raw.xz-ended img for disposable minion
Diff Detail
- Repository
- rLTRN libtaskotron
- Branch
- angel
- Lint
Lint Warnings Excuse: raw.xz is "long" compare to img Severity Location Code Message Warning libtaskotron/ext/disposable/vm.py:277 E501 flake8 100 - Unit
Unit Tests OK - Build Status
Buildable 672 Build 672: arc lint + arc unit
libtaskotron/ext/disposable/vm.py | ||
---|---|---|
277 | This does not really do what you probably think it does, as it will match e.g. 160301_1030-fedora-23-taskotron_cloud-x86_64.rawaxz, what you really want (and I'm not sure that testcloud can use xzipped raw images, but that's another can of worms) is: re.compile(r'^([0-9]{6}_[0-9]{4})-(.*?)-(.*?)-(.*?)-(.*?)\.(qcow2|raw(\.xz)?|img)$') |
Also, what is the use case for gzipped raw image? Would it not be usefull also for other formats than raw?
It might also make sense to get rid of the extension checking completely - it was initially created with one specific use-case in mind, and if we have more general usecases, it does not really make sense to make our life complicated with the ever-expanding regexp.
It will be useful for all kinds of compressed raw image if we check the suffix of the image name and uncompressed them in proper method.
It might also make sense to get rid of the extension checking completely - it was initially created with one specific use-case in mind, and if we have more general usecases, it does not really make sense to make our life complicated with the ever-expanding regexp.
yeah,+1 for that point,as testcloud grab img from the specific URL or dir ,like /var/lib/taskotron/images ,which is unlikely to be stained.
So ,should we pre-open our arm to all kinds of potential img from the future by changing the regexp to "re.compile(r'^([0-9]{6}_[0-9]{4})-(.*?)-(.*?)-(.*?)-(.*?)\..*')" ?
That is a good question. Hardcoding which images is testcloud able to handle is suboptimal. I don't see a really good solution here, especially since people might want to add e.g. _disabled suffix to an image and expect it to be invisible to us. So for the moment I'd keep the hardcoded lists. If testcloud is able to handle that (after D898), the expression ending could perhaps be something like \.(qcow2|raw|img)(\.xz)?$.
line too long (102 > 99 characters)