Getting "Archive[/tmp/${filename}] doesn't seem to be in the catalog" while executing my puppet program

asked 2017-06-29 09:12:01 -0500

rohithmn03 gravatar image

Hi Team,

My Puppet class looks like this:

FYI...

class aoa_agent_installation::splunk_install {
    $sourcefile = $osfamily ? {
        'Solaris' => 'puppet:///modules/aoa_agent_installation/splunkforwarder-6.5.2-67571ef4b87d-SunOS-sparc.tar.Z',
        'RedHat' => 'puppet:///modules/aoa_agent_installation/splunkforwarder-6.5.2-67571ef4b87d-Linux-x86_64.tgz',
        'AIX' => 'puppet:///modules/aoa_agent_installation/splunkforwarder-6.5.2-67571ef4b87d-AIX-powerpc.tgz',
    }

    $dirname = 'splunkforwarder'
    $filename = "${dirname}.tar.gz"
    $install_path = "/opt/${dirname}"

    file { $install_path:
        ensure => directory,
        owner  => 'findev',
        group  => 'finacle',
        mode   => '0777',
    }

    archive { $filename:
        path          => "/tmp/${filename}",
        source        => $sourcefile,
        extract       => true,
        extract_path  => '/opt',
        creates       => "${install_path}",
        cleanup       => true,
        user          => 'findev',
        group         => 'finacle',
        require       => File[$install_path],
    }

    exec {'start_splunk_service':
        path => '/usr/bin:/bin:/usr/sbin:/sbin',
        user => 'findev',
        command => '/opt/splunkforwarder/bin/splunk start --accept-license && echo "1" > /tmp/splunk_status.txt',
        onlyif => [ 
            "test -f /opt/splunkforwarder/bin/splunk",
            "test `ps -ef | grep -v grep | grep splunk | wc -l` -eq 0",
            ],
        environment => ["HOME=/app/finacle"],
        require => Archive[$filename],
    }

    file { '/opt/splunkforwarder/etc/system/local/deploymentclient.conf': 
        ensure => present,
        owner => 'findev',
        group => 'finacle',
        mode => "0777",
        source => 'puppet:///modules/aoa_agent_installation/deploymentclient.conf',
        require => Archive[$filename],
    }

    exec {'restart_start_splunk_service':
        path => '/usr/bin:/bin:/usr/sbin:/sbin',
        user => 'findev',
        command => '/opt/splunkforwarder/bin/splunk restart && echo "0" > /tmp/splunk_status.txt',
        onlyif => [ 
            "test -f /opt/splunkforwarder/bin/splunk",
            "test `cat /tmp/splunk_status.txt | tr -s ' '` -eq 1",
            ],
        environment => ["HOME=/app/finacle"],
        require => File['/opt/splunkforwarder/etc/system/local/deploymentclient.conf'],
    }
}

Error:

Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Invalid relationship: Exec[start_splunk_service] { require => Archive[/tmp/${filename}] }, because Archive[/tmp/${filename}] doesn't seem to be in the catalog
edit retag flag offensive close merge delete

Comments

Are you sure, that that what we're looking at is causing the problem? Can you introduce a syntax error and re-run? Can you strip (comment out) your manifest to the bare minimum and comment in each block after another, to see to what degree it works?

Kai Burghardt gravatar imageKai Burghardt ( 2017-07-08 08:57:36 -0500 )edit