Ask Your Question
0

Error: Could not find parent resource type 'sshd::params' of type hostclass in production at ...

asked 2015-03-19 08:58:32 -0500

DanielG gravatar image

updated 2015-03-19 10:13:09 -0500

Hello, I have two questions. The first question is about the error I am getting:

>  Error: Could not find parent resource type 'sshd::params' of type hostclass in production at /etc/puppetlabs/puppet/environments/production/modules/sshd/manifests/init.pp:1 on node ...

I wrote just a little sshd-module and wanted to put the params at params.pp:

class sshd (

    #$protocol                       = $sshd::params::protocol,
    $protocol                       = $params::protocol,
    $logLevel                       = $params::logLevel,
    $permitRootLogin                = $params::permitRootLogin,
    $hostbasedAuthentication        = $params::hostbasedAuthentication,
    $ignoreRhosts                   = $params::ignoreRhosts,
    $permitEmptyPasswords           = $params::permitEmptyPasswords,
    $x11Forwarding                  = $params::x11Forwarding,
    $usePrivilegeSeparation         = $params::usePrivilegeSeparation,
    $clientAliveCountMax            = $params::clientAliveCountMax,
    $subsystem                      = $params::subsystem,
    $maxAuthTries                   = $params::maxAuthTries,
    $allowGroups                    = $params::allowGroups,

    ) inherits sshd::params  {

    file { "/etc/ssh/sshd_config.dg":
            ensure  =>      present,
            path    =>      '/etc/ssh/sshd_config.dg',
            content =>      template('sshd/sshd_config.erb'),
        }
}

include sshd
~

As you can see I tried to put the params with $sshd::params::protocol or without the "sshd::", but get the same error. And my params.pp :

class sshd::params {
        $protocol                       = '2'
        $logLevel                      = 'verbose'
        $permitRootLogin               = 'yes'
        $hostbasedAuthentication       = 'yes'
        $ignoreRhosts                  = 'no'
        $permitEmptyPasswords          = 'no'
        $x11Forwarding                 = 'yes'
        $usePrivilegeSeparation        = 'yes'
        $clientAliveCountMax           = '0'
        $subsystem                     = 'sftp   /usr/sbin/sftp-server'
        $maxAuthTries                  = '4'
        $allowGroups                   = 'glogin'
}

I don´t know what´s going wrong, for me it looks like in the fundamentals course. And when I try to run:

puppet apply init.pp --noop --verbose

I get the error. If I am going to base folder still the same, with:

puppet apply /etc/puppetlabs/puppet/environments/production/modules/sshd/manifests/init.pp --noop --verbose

The template is just the sshd_config file copied and added the params like that:

Protocol <%= @protocol %>

The second question shocked me a little. I did not classify this class at all, not in the Puppet Enterprise Console neither in site.pp. But somehow one of my nodes did get the class / the file. How could this happened? Are there any other methods to classificate?

image description As you can see it worked to create the file, because I first put the values for the params directly in the "class sshd".

Afterwards I also get the error in the PEC as mentioned above. It just happened on one node so it has to be decleraed somewhere. But i don´t know how and I am the only one working with this system. And since today there isn´t anything about the sshd in the PEC ... i don´t get it. Maybe someone could explain how this is even possible.

Thank you in advance for some feedback/help.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-03-25 15:44:27 -0500

WhatsARanjit gravatar image

Don't put include sshd in your manifests/init.pp. Anything in your manifests directory is simply a class definition. The way you execute anything in the class is by declaring it with include sshd. This declaration should exist in the Console, site.pp, or a smoke test. I'd suggest adding a tests directory to your module. In that directory, write an init.pp that says nothing but include sshd and then puppet apply that.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-03-19 08:58:32 -0500

Seen: 839 times

Last updated: Mar 25 '15