FAQ
I'd like to create and call a parameterized class from another class,
both in modules. Here's what I'm trying to do:

First, my module path:

ap00375@ROFTMA901A ~ $ sudo puppet apply --configprint modulepath
/modules:/shares/nfs/unixnoarch/config/puppet:/shares/nfs/unixnoarch/config/puppet/linux

Here, you can see the two modules in question:

ap00375@ROFTMA901A ~ $ find /shares/nfs/unixnoarch/config/puppet/ -name
'init.pp'
/shares/nfs/unixnoarch/config/puppet/tws_node/manifests/init.pp
/shares/nfs/unixnoarch/config/puppet/filesys_group_acl/manifests/init.pp

Here's the contents of tws_node's init.pp:

class tws_node {

   $userhome="/opt/IBM/TWS"

   filesys_group_acl { "ibmtm_acl_group_ibmtm" :
# subscribe => File["$userhome"],
     dir => $userhome,
     group => "ibmtm",
   }

}

And the contents of filesys_group_acl's init.pp (the parameterized one)


class filesys_group_acl ($dir = '', $group = '') {

   exec { "apply_acl_${title}":
     unless => "/usr/bin/getfacl $dir 2>/dev/null | /bin/grep
group:$group: > /dev/null",
     command => "/usr/bin/setfacl -R -m group:$group:rwx -m
default:group:$group:rwx $dir",
   }

}


And it's complaining about the parameterized class, filesys_group_acl:

ap00375@ROFTMA901A ~ $ sudo puppet apply --noop --verbose --execute
"include tws_node"
Error: Puppet::Parser::AST::Resource failed with error ArgumentError:
Invalid resource type filesys_group_acl at
/shares/nfs/unixnoarch/config/puppet/tws_node/manifests/init.pp:10 on
node roftma901a.mayo.edu
Error: Puppet::Parser::AST::Resource failed with error ArgumentError:
Invalid resource type filesys_group_acl at
/shares/nfs/unixnoarch/config/puppet/tws_node/manifests/init.pp:10 on
node roftma901a.mayo.edu


Any help, please? What am I missing?

Thanks,
-- Pat

Search Discussions

  • Cory Stoker at Oct 3, 2013 at 4:54 am
    Not sure if you got help or not but that error is telling you that
    filesys_group_acl is not a resource type. This is because you created
    it as a class and not a defined resource type. Defined types use the
    "define" keyword instead of the "class" keyword.

    http://docs.puppetlabs.com/puppet/3/reference/lang_defined_types.html

    HTH

    -Cory
    On Tue, Oct 1, 2013 at 9:17 AM, Patrick Spinler wrote:

    I'd like to create and call a parameterized class from another class,
    both in modules. Here's what I'm trying to do:

    First, my module path:

    ap00375@ROFTMA901A ~ $ sudo puppet apply --configprint modulepath
    /modules:/shares/nfs/unixnoarch/config/puppet:/shares/nfs/unixnoarch/config/puppet/linux

    Here, you can see the two modules in question:

    ap00375@ROFTMA901A ~ $ find /shares/nfs/unixnoarch/config/puppet/ -name
    'init.pp'
    /shares/nfs/unixnoarch/config/puppet/tws_node/manifests/init.pp
    /shares/nfs/unixnoarch/config/puppet/filesys_group_acl/manifests/init.pp

    Here's the contents of tws_node's init.pp:

    class tws_node {

    $userhome="/opt/IBM/TWS"

    filesys_group_acl { "ibmtm_acl_group_ibmtm" :
    # subscribe => File["$userhome"],
    dir => $userhome,
    group => "ibmtm",
    }

    }

    And the contents of filesys_group_acl's init.pp (the parameterized one)


    class filesys_group_acl ($dir = '', $group = '') {

    exec { "apply_acl_${title}":
    unless => "/usr/bin/getfacl $dir 2>/dev/null | /bin/grep
    group:$group: > /dev/null",
    command => "/usr/bin/setfacl -R -m group:$group:rwx -m
    default:group:$group:rwx $dir",
    }

    }


    And it's complaining about the parameterized class, filesys_group_acl:

    ap00375@ROFTMA901A ~ $ sudo puppet apply --noop --verbose --execute
    "include tws_node"
    Error: Puppet::Parser::AST::Resource failed with error ArgumentError:
    Invalid resource type filesys_group_acl at
    /shares/nfs/unixnoarch/config/puppet/tws_node/manifests/init.pp:10 on
    node roftma901a.mayo.edu
    Error: Puppet::Parser::AST::Resource failed with error ArgumentError:
    Invalid resource type filesys_group_acl at
    /shares/nfs/unixnoarch/config/puppet/tws_node/manifests/init.pp:10 on
    node roftma901a.mayo.edu


    Any help, please? What am I missing?

    Thanks,
    -- Pat
    --
    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 post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rahul Khengare at Oct 3, 2013 at 6:58 am
    Hi Patrick,
        You calling the filesys_group_acl class in wrong way. Way you are using
    is for function/defined type.

    Make following change in your manifests.

    Here's the contents of tws_node's init.pp:
    class tws_node {

    $userhome="/opt/IBM/TWS"
      # filesys_group_acl { "ibmtm_acl_group_ibmtm" :


    Change calling of class method :
    * class { "filesys_group_acl": *

    # subscribe => File["$userhome"],
    dir => $userhome,
    group => "ibmtm",
    }

    }
    If you want to use filesys_group_acl resource multiple times then change
    class to defined type.
    http://docs.puppetlabs.com/learning/definedtypes.html

    I hope this will help.

    Thanks and Regards,
    Rahul Khengare
    NTT DATA OSS Center, Pune, India.


    --
    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 post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 1, '13 at 3:22p
activeOct 3, '13 at 6:58a
posts3
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2021 Grokbase