-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buggy Docker_Volume options #507
Comments
I'm not sure it's related but running The following is how I tested via hiera classes:
- docker::images
- docker::volumes
docker::volumes::volumes:
mayan-edms:
ensure: present
driver: local
mayan-edms-postgres:
ensure: present
driver: local And here is how I tested the classic way node 'foo' {
include docker::volumes
docker_volume { 'mayan-edms2':
ensure => present
}
} I'm probably doing something stupid and missing something but I don't see it docker::volumes run at all with either method. Same version of docker as the OP though |
I did the PR 2 month ago to change the documentation from array to hash format. As @gdlx wrote there is a notice to change the resource on every puppet run. This is because the provider detects the difference but does not support applying changes to the existing resource. May be its best to flatten the hash to an array in case: --- a/lib/puppet/provider/docker_volume/ruby.rb
+++ b/lib/puppet/provider/docker_volume/ruby.rb
@@ -11,6 +11,7 @@ Puppet::Type.type(:docker_volume).provide(:ruby) do
def volume_conf
flags = ['volume', 'create']
multi_flags = ->(values, format) {
+ values = values.map! { |k,v| "#{k}=#{v}" } if values.is_a? Hash
filtered = [values].flatten.compact
filtered.map { |val| format % val }
} The provider should also add at least some warning in case of changes he is unable to apply. |
I wish it really becomes the expected format, because it's the most convenient one, but I don't know if there's a technical constraint forcing to use this double nested array format... |
Closing issue as PR was merged |
What you expected to happen?
Filling Docker_Volume options with a Hash, as defines in the doc: https://forge.puppet.com/puppetlabs/docker#volumes
What happened?
I get the following error:
The options hash is sent to the docker command as a json strin instead of multiple
--opt
parameters.Please note I've already seen #197, there's still an issue.
How to reproduce it?
Define a docker volume with multiple options like this:
Anything else we need to know?
Looking at #197, the only way I've been able to define the volume options, is not in an array, but in 2 arrays, like this:
It's working fine, even if the syntax is a bit odd, but each time I run Puppet then I get this notice:
So there is clearly something wrong with the way volume options is handled: The syntax is not the same than in the docs, and the current state doesn't give the same result, leading to a detected difference on each Puppet run.
Versions:
But here's my
Puppetfile.lock
:The text was updated successfully, but these errors were encountered: