FAQ
Hi list,

I have a define type with parameters like this:

define user ( $username=$title,
                 $comment='',
                 $uid='',
                 $gid=$uid,
                 $groups=[ 'users',],
                 $password='',
                 $shell="/bin/false",
                 $sudo=false,
                 $sudo_nopasswd=false, ) {
#### actual definition
}

That gets called by init.pp:

class users ($data) {
         create_resources(user, $data)
}

I'm trying to pass a yaml to it:
user:
   uid: 500
   comment: Test user
   password: PW HASH
   shell: /bin/bash

Now this works perfectly fine, and the user gets created, but as soon as I
try to pass sudo it fails (it does the same for the sudo_nopasswd
parameter):
user:
   uid: 500
   comment: Test user
   password: PW HASH
   shell: /bin/bash
   sudo: true

Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
Invalid parameter sudo on node puppet.local

It does not matter if I do anything with the sudo parameter. The default
works, but as soon as I alter it via yaml it throws the error. There is no
sudo class, not any other parameter containing "sudo" in the host yaml.


Any ideas what could be causing this?

Thanks!

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c7f05e42-26d1-4dda-8379-f596407f3825%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Ramin K at Jan 13, 2014 at 9:50 pm

    On 1/13/2014 1:36 PM, Karolis Pabijanskas wrote:


    Hi list,

    I have a define type with parameters like this:

    define user ( $username=$title,
    $comment='',
    $uid='',
    $gid=$uid,
    $groups=[ 'users',],
    $password='',
    $shell="/bin/false",
    $sudo=false,
    $sudo_nopasswd=false, ) {
    #### actual definition
    }

    That gets called by init.pp:

    class users ($data) {
    create_resources(user, $data)
    }

    I'm trying to pass a yaml to it:
    user:
    uid: 500
    comment: Test user
    password: PW HASH
    shell: /bin/bash

    Now this works perfectly fine, and the user gets created, but as soon as
    I try to pass sudo it fails (it does the same for the sudo_nopasswd
    parameter):
    user:
    uid: 500
    comment: Test user
    password: PW HASH
    shell: /bin/bash
    sudo: true

    Error: Could not retrieve catalog from remote server: Error 400 on
    SERVER: Invalid parameter sudo on node puppet.local

    It does not matter if I do anything with the sudo parameter. The default
    works, but as soon as I alter it via yaml it throws the error. There is
    no sudo class, not any other parameter containing "sudo" in the host yaml.


    Any ideas what could be causing this?
    Hiera and booleans not playing nicely, I think.
    http://projects.puppetlabs.com/issues/17105

    and for workarounds,
    https://groups.google.com/forum/#!topic/puppet-users/BLw91HEpP0I

    Ramin

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/52D45F9C.6010000%40badapple.net.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Karolis Pabijanskas at Jan 13, 2014 at 10:08 pm
    Thanks for this, however this is unlikely. This error is there even when
    the sudo and sudo_nopasswd variables are strings. Even if I pass something
    like:

    user:
       uid: 500
       comment: Test user
       password: PW HASH
       shell: /bin/bash
       sudo: Whatever

    I get the same error. The sudo_nopasswd might get set to "NOPASSWD" and
    that fails too with the same error.

    I might also set:

    define user ( $username=$title,
                     $comment='',
                     $uid='',
                     $gid=$uid,
                     $groups=[ 'users',],
                     $password='',
                     $shell="/bin/false",
                     $sudo="disable",
                     $sudo_nopasswd="disable", )

    and then do check on that and then pass:
      sudo: enable

    And it still fails with the same error

    On Monday, 13 January 2014 21:50:20 UTC, Ramin K wrote:
    On 1/13/2014 1:36 PM, Karolis Pabijanskas wrote:



    Hi list,

    I have a define type with parameters like this:

    define user ( $username=$title,
    $comment='',
    $uid='',
    $gid=$uid,
    $groups=[ 'users',],
    $password='',
    $shell="/bin/false",
    $sudo=false,
    $sudo_nopasswd=false, ) {
    #### actual definition
    }

    That gets called by init.pp:

    class users ($data) {
    create_resources(user, $data)
    }

    I'm trying to pass a yaml to it:
    user:
    uid: 500
    comment: Test user
    password: PW HASH
    shell: /bin/bash

    Now this works perfectly fine, and the user gets created, but as soon as
    I try to pass sudo it fails (it does the same for the sudo_nopasswd
    parameter):
    user:
    uid: 500
    comment: Test user
    password: PW HASH
    shell: /bin/bash
    sudo: true

    Error: Could not retrieve catalog from remote server: Error 400 on
    SERVER: Invalid parameter sudo on node puppet.local

    It does not matter if I do anything with the sudo parameter. The default
    works, but as soon as I alter it via yaml it throws the error. There is
    no sudo class, not any other parameter containing "sudo" in the host yaml.

    Any ideas what could be causing this?
    Hiera and booleans not playing nicely, I think.
    http://projects.puppetlabs.com/issues/17105

    and for workarounds,
    https://groups.google.com/forum/#!topic/puppet-users/BLw91HEpP0I

    Ramin
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/f1060437-c578-43e5-b8e5-6a8e6f82f885%40googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jcbollinger at Jan 13, 2014 at 11:26 pm

    On Monday, January 13, 2014 3:36:25 PM UTC-6, Karolis Pabijanskas wrote:


    Hi list,

    I have a define type with parameters like this:

    define user ( $username=$title,
    $comment='',
    $uid='',
    $gid=$uid,
    $groups=[ 'users',],
    $password='',
    $shell="/bin/false",
    $sudo=false,
    $sudo_nopasswd=false, ) {
    #### actual definition
    }

    That gets called by init.pp:

    class users ($data) {
    create_resources(user, $data)
    }

    I'm trying to pass a yaml to it:
    user:
    uid: 500
    comment: Test user
    password: PW HASH
    shell: /bin/bash

    Now this works perfectly fine, and the user gets created, but as soon as I
    try to pass sudo it fails (it does the same for the sudo_nopasswd
    parameter):
    user:
    uid: 500
    comment: Test user
    password: PW HASH
    shell: /bin/bash
    sudo: true

    Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
    Invalid parameter sudo on node puppet.local
    That appears to be telling you that Puppet doesn't think type "user" has a
    parameter named "sudo". And indeed, the built-in User type doesn't, though
    it does have uid, comment, password, and shell. Almost certainly,
    create_resources is trying to declare an instance of the built-in User type
    instead of your defined type. The same might happen if you use an ordinary
    declaration.

    You should put your defined type in a module, and refer to it by its
    qualifed name. Indeed, all classes and defined types you write should go
    into modules.

    As an aside, do not confuse Puppet's keyword for declaring a user-defined
    resource type ("define") with the C preprocessor's keyword for defining a
    macro ("#define"). User-defined resource types are bona fide resource
    types, not macros.


    John

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/014ef5fb-b2db-498c-a8c4-e98138ac6368%40googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJan 13, '14 at 9:42p
activeJan 13, '14 at 11:26p
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase