Skip to content
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

Allow using $http_cfg_append with list of lists #369

Merged
merged 1 commit into from
Jul 1, 2014
Merged

Allow using $http_cfg_append with list of lists #369

merged 1 commit into from
Jul 1, 2014

Conversation

motiejus
Copy link
Contributor

Since 5a9767d we are not able to use list of lists in $http_cfg_append.

It should be possible to include a list of lists in order to have duplicate configuration keys, like:

nginx::http_cfg_append:
    - [include, /etc/nginx/vhosts/*.ngx]
    - [include, /etc/nginx/vhosts/*/*.ngx]

Discussion:
I reverted the validation, which is sub-optimal. However, ideally, the patch should look like:

-    validate_hash($http_cfg_append)
+    validate_hash($http_cfg_append) || validate_array($http_cfg_append)

but since both functions raise Puppet::Error, there is no way that I know of to make such a conditional happen.

@jfryman
Copy link
Contributor

jfryman commented Jun 30, 2014

Seems like you could do one of these...

if !is_hash($http_cfg_append) or !is_array($http_cfg_append) {
  fail('$http_cfg_append must be either a hash or array')
}

It should be possible to include array of arrays in order to have
duplicate configuration keys (when permitted), like:

    nginx::http_cfg_append:
        - [include, /etc/nginx/vhosts/*.ngx]
        - [include, /etc/nginx/vhosts/*/*.ngx]
@motiejus
Copy link
Contributor Author

motiejus commented Jul 1, 2014

Thanks, fixed!

@jfryman
Copy link
Contributor

jfryman commented Jul 1, 2014

👍

jfryman pushed a commit that referenced this pull request Jul 1, 2014
Allow using $http_cfg_append with list of lists
@jfryman jfryman merged commit e270b76 into voxpupuli:master Jul 1, 2014
@motiejus motiejus deleted the validate_hash branch July 1, 2014 13:55
@Billiam
Copy link

Billiam commented Jul 2, 2014

Won't that logic always fail for non-true http_cfg_append values, since a given value will either: not be a hash or not be an array?

@motiejus
Copy link
Contributor Author

motiejus commented Jul 2, 2014

I am not following you. Can you provide an exmaple?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants