I have three questions for Tom, et al, regarding the features I've been working on lately. Please let me know your opinions on each of the below:
I'm currently working on allowing pkg.install to accept multiple packages in a single call on various package providers, a feature only presently available in the yumpkg provider. Additionally, I am adding where it doesn't exist the ability to install a package from a file. The later feature uses a new keyword argument, "sources".
Currently, since not all package providers have both of these features implemented, the pkg state does not yet support either of these options. However, thinking forward to how this would be implemented in states, it seems natural to accept "sources" as a list. However, you cannot submit the sources as a list via CLI, you need to use a comma separated string, which is then split into a list.
My first question is this: would it be fine to accept both the package names and sources as either a string or a list? Some try/except logic could be used within the different package providers' respective install() functions to split if needed.
If it is implemented in this way, then both of the following would do the same thing:
method_1:
pkg.installed:
- names:
- foo
- bar
- baz
- sources:
- salt://foo.rpm
- http://somesite.org/bar.rpm
- ftp://somesite.net/baz.rpm
method_2:
pkg.installed:
- name: foo,bar,baz
- sources: salt://foo.rpm,http://somesite.org/bar.rpm,ftp://somesite.net/baz.rpmI'm not sure if this be considered "OK", or if the ambiguity would not be desired. If not, then the only option would be only to accept the input as a string. In other words, method_1 above would not work, and method_2 would be the only valid way of submitting multiple package sources. Personally, I like the idea of flexibility, and method_1 above would look great in SLS, but I'd like to get some feedback before I write the code and submit a pull req.
Second question: In yumpkg.py, which has for some time had the ability to install multiple packages from the repositories in a single call, the code currently allows for either submitting the packages and sources as a comma-separated or space-separated list. I propose removing the option to use a space as the delimiter, and only allowing comma-separated lists. This is an area where I think ambiguity is not a good thing. Thoughts?
Third question: Providers like yum and zypper both allow you to mix RPM and repository packages. That said, it follows that you should be able to mix RPM and repo sources in the same ID declaration. Here's my proposal for doing this, does it look good?
method_1:
pkg.installed:
- names:
- foo
- bar
- baz
- sources:
- salt://foo.rpm
- None
- ftp://somesite.net/baz.rpm
method_2:
pkg.installed:
- name: foo,bar,baz
- sources: salt://foo.rpm,None,ftp://somesite.net/baz.rpm
In this case, a value of None (or 'None', if submitted as a string via method_2 above, or via CLI) would tell the install() function to use the repository instead of an RPM/deb/etc. package file. It may seem a little confusing to see None as a source, but the docstring for the individual pkg.install() functions would clear that up.
Thanks in advance for your input,
--
-Erik
"For me, it is far better to grasp the universe as it really is than to persist in delusion, however satisfying and reassuring." -- Carl Sagan