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

parameter 'mappings' expects an Array value, got Struct #125

Closed
jurim76 opened this issue May 11, 2018 · 2 comments · Fixed by #145
Closed

parameter 'mappings' expects an Array value, got Struct #125

jurim76 opened this issue May 11, 2018 · 2 comments · Fixed by #145
Labels
bug Something isn't working

Comments

@jurim76
Copy link

jurim76 commented May 11, 2018

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 4.10.4
  • Ruby: 2.3.3
  • Distribution: Debian 9
  • Module version: 5.0.0

How to reproduce (e.g Puppet code you use)

hiera yaml example

autofs::mounts:
gmail:
mount: '/srv'
mapfile: '/etc/auto.master.d/auto.gmail'

autofs::mapfiles:
gmail:
path: '/etc/auto.master.d/auto.gmail'
mappings:
key: 'gmail'
options: 'rw,soft,intr,tcp,nfsvers=4,noacl'
fs: 'ld-sys-smb:/srv/gmail'

What are you seeing

puppet agent -t
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Autofs::Mapfile[gmail]: parameter 'mappings' expects an Array value, got Struct at /srv/puppet/env/production/modules/autofs/manifests/init.pp:111

What behaviour did you expect instead

Output log

Any additional information you'd like to impart

@juniorsysadmin juniorsysadmin added the bug Something isn't working label May 12, 2018
@sycobuny
Copy link

This seems likely to be a bug in documentation rather than code. The README shows the following YAML snippet as an example (which matches the style of the input above):

autofs::mapfiles:
  home:
    path: '/etc/auto.home'
    mappings:
      key: '*'
      options: 'rw,soft,intr'
      fs: 'server.example.com:/path/to/home/shares'

Whereas, per the definition of Autofs::Mapfile (and the error message the user listed above), you probably want a snippet that looks more like the following, which ensures that the mappings element is parsed as an Array rather than a Struct:

autofs::mapfiles:
  home:
    path: '/etc/auto.home'
    mappings:
      - key: '*'
        options: 'rw,soft,intr'
        fs: 'server.example.com:/path/to/home/shares'

I can certainly fork and submit a pull request, but for a minor change like this it may be faster for someone on the team to update the repo directly.

In any case, the YAML which I believe should work for @jurim76 would look like this instead:

autofs::mapfiles:
  gmail:
    path: '/etc/auto.master.d/auto.gmail'
    mappings:
      - key: 'gmail'
        options: 'rw,soft,intr,tcp,nfsvers=4,noacl'
        fs: 'ld-sys-smb:/srv/gmail'

@dhollinger
Copy link
Member

Looks like we missed a docs update when autofs::mapfiles was updated for the last major release. I'll take a look at this tomorrow, unless someone wants to submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants