voxpupuli / puppet-splunk

Manage Splunk servers and forwarders using Puppet
https://forge.puppet.com/puppet/splunk
Apache License 2.0
40 stars 121 forks source link

dependency cycle error while deploying forwarder only #65

Open leemachine opened 7 years ago

leemachine commented 7 years ago

Hello,

I'm attempting to use your module to deploy the Splunk Forwarder only and Puppet throws a dependancy cycle error. I'm testing using Pupply apply if that makes a differenance.

Notice: Compiled catalog for <hostname> in environment production in 0.65 seconds
Error: Failed to apply catalog: Found 1 dependency cycle:
(File[/opt/staging/splunk/splunkforwarder-6.5.0-59c8927def0f-linux-2.6-x86_64.rpm] => Staging::File[splunkforwarder-6.5.0-59c8927def0f-linux-2.6-x86_64.rpm] => Package[splunkforwarder] => File[/opt/staging/splunk/splunkforwarder-6.5.0-59c8927def0f-linux-2.6-x86_64.rpm])
Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz

Here is how I call the module:

class profiles::splunk_forwarder (
  $server  = 'splunk.domain',  
  $version = '6.5.0',  
  $build   = '59c8927def0f',
) {
  class { ::splunk::params:
    server  => "$server",
    version => "$version",
    build   => "$build"
  }
  include ::splunk::forwarder
 }
crayfishx commented 7 years ago

@leemachine You are declaring the class wrong, you shouldn't declare ::splunk::params directly. The way the params.pp pattern should work is that you declare the base class, in this case ::splunk::forwarder and override settings there, that class inherits off ::splunk::params to get default values..... but the splunk module has an interesting and pretty flawed implementation of params.pp pattern.

You probably need something like

class profiles::splunk_forwarder (
 include ::splunk::forwarder

and then in hiera

splunk::params::version: 6.5.0
splunk::params::build: 59c8927def0f

The hiera values will get read into splunk::params automatically when it's inherited from splunk::forwarder... It's all a bit special.

mwhitake commented 7 years ago

I have run into the same problem mentioned above and tried the approach you suggested, but I am still running into a dependency problem. Looking for any advice, as I would like to make use of this module. Thanks for any help you can give!

Here is my config:

class profile::splunk_forwarder { include ::splunk::forwarder }

And hiera: splunk::params::version: '6.4.0' splunk::params::build: 'f2c836328108' splunk::params::src_root: 'puppet:///modules/splunk'

But when I run the puppet agent, I get: Error: Failed to apply catalog: Found 1 dependency cycle: (File[/opt/staging/splunk/splunkforwarder-6.4.0-f2c836328108-linux-2.6-x86_64.rpm] => Staging::File[splunkforwarder-6.4.0-f2c836328108-linux-2.6-x86_64.rpm] => Package[splunkforwarder] => File[/opt/staging/splunk/splunkforwarder-6.4.0-f2c836328108-linux-2.6-x86_64.rpm]) Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz

crayfishx commented 7 years ago

Tried to simulate this last night and I can't generate the same behaviour...

[root@localhost ~]# ls /vagrant/universalforwarder/linux
splunkforwarder-6.4.1-debde650d26e-linux-2.6-x86_64.rpm
[root@localhost ~]# cat /etc/puppetlabs/code/environments/production/hieradata/common.yaml
splunk::params::src_root: /vagrant
splunk::params::build: debde650d26e
splunk::params::version: 6.4.1
[root@localhost ~]#
[root@localhost ~]# puppet apply -e 'include ::splunk::forwarder' --noop
Notice: Compiled catalog for localhost in environment production in 0.83 seconds
Notice: /Stage[main]/Staging/File[/opt/staging]/ensure: current_value absent, should be directory (noop)
Notice: Class[Staging]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/Splunk::Forwarder/Staging::File[splunkforwarder-6.4.1-debde650d26e-linux-2.6-x86_64.rpm]/File[/opt/staging/splunk]/ensure: current_value absent, should be directory (noop)
Notice: /Stage[main]/Splunk::Forwarder/Staging::File[splunkforwarder-6.4.1-debde650d26e-linux-2.6-x86_64.rpm]/File[/opt/staging/splunk/splunkforwarder-6.4.1-debde650d26e-linux-2.6-x86_64.rpm]/ensure: current_value absent, should be file (noop)
Notice: Staging::File[splunkforwarder-6.4.1-debde650d26e-linux-2.6-x86_64.rpm]: Would have triggered 'refresh' from 2 events
Notice: /Stage[main]/Splunk::Forwarder/Package[splunkforwarder]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Splunk::Forwarder/Splunkforwarder_input[default_host]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Splunk::Forwarder/Splunkforwarder_output[tcpout_defaultgroup]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Splunk::Forwarder/Splunkforwarder_output[defaultgroup_server]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Splunk::Forwarder/Splunkforwarder_web[forwarder_splunkd_port]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Splunk::Forwarder/File[/opt/splunkforwarder/etc/system/local/inputs.conf]/ensure: current_value absent, should be file (noop)
Notice: /Stage[main]/Splunk::Forwarder/File[/opt/splunkforwarder/etc/system/local/outputs.conf]/ensure: current_value absent, should be file (noop)
Notice: /Stage[main]/Splunk::Forwarder/File[/opt/splunkforwarder/etc/system/local/web.conf]/ensure: current_value absent, should be file (noop)
Notice: Class[Splunk::Forwarder]: Would have triggered 'refresh' from 9 events
Notice: /Stage[main]/Splunk::Platform::Posix/Exec[license_splunkforwarder]/returns: current_value notrun, should be 0 (noop)
Notice: /Stage[main]/Splunk::Platform::Posix/Exec[enable_splunkforwarder]/returns: current_value notrun, should be 0 (noop)
Notice: Class[Splunk::Platform::Posix]: Would have triggered 'refresh' from 2 events
Notice: /Stage[main]/Splunk::Virtual/Service[splunk]/ensure: current_value stopped, should be running (noop)
Notice: Class[Splunk::Virtual]: Would have triggered 'refresh' from 1 events
Notice: Stage[main]: Would have triggered 'refresh' from 4 events
Notice: Applied catalog in 0.54 seconds

Tested with the following versions....

[root@localhost ~]# puppet module list --tree
/etc/puppetlabs/code/environments/production/modules
├── puppet-splunk (v5.0.1-rc0)
├── puppet-staging (v2.0.1)
├── puppetlabs-inifile (v1.6.0)
└── puppetlabs-stdlib (v4.13.1)

What versions are you using here?

Also what version of ruby and puppet?

mwhitake commented 7 years ago

Versions I am using here are:

├── puppet-splunk (v5.0.1) ├── puppet-staging (v2.0.2-rc0) ├── puppetlabs-inifile (v1.6.0) ├── puppetlabs-stdlib (v4.13.1)

On Thu, Dec 1, 2016 at 3:45 AM, Craig Dunn notifications@github.com wrote:

Tried to simulate this last night and I can't generate the same behaviour...

[root@localhost ~]# ls /vagrant/universalforwarder/linux splunkforwarder-6.4.1-debde650d26e-linux-2.6-x86_64.rpm [root@localhost ~]# cat /etc/puppetlabs/code/environments/production/hieradata/common.yaml splunk::params::src_root: /vagrant splunk::params::build: debde650d26e splunk::params::version: 6.4.1 [root@localhost ~]#

[root@localhost ~]# puppet apply -e 'include ::splunk::forwarder' --noop Notice: Compiled catalog for localhost in environment production in 0.83 seconds Notice: /Stage[main]/Staging/File[/opt/staging]/ensure: current_value absent, should be directory (noop) Notice: Class[Staging]: Would have triggered 'refresh' from 1 events Notice: /Stage[main]/Splunk::Forwarder/Staging::File[splunkforwarder-6.4.1-debde650d26e-linux-2.6-x86_64.rpm]/File[/opt/staging/splunk]/ensure: current_value absent, should be directory (noop) Notice: /Stage[main]/Splunk::Forwarder/Staging::File[splunkforwarder-6.4.1-debde650d26e-linux-2.6-x86_64.rpm]/File[/opt/staging/splunk/splunkforwarder-6.4.1-debde650d26e-linux-2.6-x86_64.rpm]/ensure: current_value absent, should be file (noop) Notice: Staging::File[splunkforwarder-6.4.1-debde650d26e-linux-2.6-x86_64.rpm]: Would have triggered 'refresh' from 2 events Notice: /Stage[main]/Splunk::Forwarder/Package[splunkforwarder]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Splunk::Forwarder/Splunkforwarder_input[default_host]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Splunk::Forwarder/Splunkforwarder_output[tcpout_defaultgroup]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Splunk::Forwarder/Splunkforwarder_output[defaultgroup_server]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Splunk::Forwarder/Splunkforwarder_web[forwarder_splunkd_port]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Splunk::Forwarder/File[/opt/splunkforwarder/etc/system/local/inputs.conf]/ensure: current_value absent, should be file (noop) Notice: /Stage[main]/Splunk::Forwarder/File[/opt/splunkforwarder/etc/system/local/outputs.conf]/ensure: current_value absent, should be file (noop) Notice: /Stage[main]/Splunk::Forwarder/File[/opt/splunkforwarder/etc/system/local/web.conf]/ensure: current_value absent, should be file (noop) Notice: Class[Splunk::Forwarder]: Would have triggered 'refresh' from 9 events Notice: /Stage[main]/Splunk::Platform::Posix/Exec[license_splunkforwarder]/returns: current_value notrun, should be 0 (noop) Notice: /Stage[main]/Splunk::Platform::Posix/Exec[enable_splunkforwarder]/returns: current_value notrun, should be 0 (noop) Notice: Class[Splunk::Platform::Posix]: Would have triggered 'refresh' from 2 events Notice: /Stage[main]/Splunk::Virtual/Service[splunk]/ensure: current_value stopped, should be running (noop) Notice: Class[Splunk::Virtual]: Would have triggered 'refresh' from 1 events Notice: Stage[main]: Would have triggered 'refresh' from 4 events Notice: Applied catalog in 0.54 seconds

Tested with the following versions....

[root@localhost ~]# puppet module list --tree /etc/puppetlabs/code/environments/production/modules ├── puppet-splunk (v5.0.1-rc0) ├── puppet-staging (v2.0.1) ├── puppetlabs-inifile (v1.6.0) └── puppetlabs-stdlib (v4.13.1)

What versions are you using here?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/voxpupuli/puppet-splunk/issues/65#issuecomment-264113683, or mute the thread https://github.com/notifications/unsubscribe-auth/ARzBWBHhHGIcHpt5U0OEz2gz-N3C7p4iks5rDolFgaJpZM4KhbB0 .

-- Gordon Food Service® | matt.whitaker@gfs.com | 616.717.6045

samwjq commented 6 years ago

Don't use name as "class profiles::splunk_forwarder", it will conflict with the tag name.

So I use "class profiles::splunkforwarder" will work around the problem.

Quite hidden problem.