Ask Your Question

tidy resource failing with "already defined" error .

asked 2017-04-06 04:12:28 -0500

queszama gravatar image

updated 2017-04-06 06:31:25 -0500

I have written the following manifests using tidy resource to delete old war files

   $ cat /home/kar/cleanwars.pp
       node '' {
            tidy { '/home/kar/temp/':
            path=> '/home/kar/temp/',
            age => '1w',
            recurse => true,
            matches => [ 'myapp-*.war','hisapp-*.war' ],

But I am seeing the following error when it is being executed.

  2017-04-06 16:24:32,939 ERROR [qtp1760700677-69] [puppet-server] Puppet Node '' is already defined at line 1; cannot redefine at line 9 on node

There is a another manifests file site.pp in the same directory which has been defined for this host . This site.pp is as follows

There is another manifests file (site.pp) on the same directory where we are using the same hosts as defined above . This manifests file is as follows

node default{

node '','' {
path   =>"/data/dist/apps/myapp-$version.war",
ensure => present,
group  => 'admin',
owner  => 'tomcat',
source => "puppet:///modules/helloworld/myapp-$version.war",


Please suggest how to resolve the issue

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-04-06 06:27:55 -0500

puser gravatar image

I assume there is more code than this. I would need to see it in order to make a determination. Are you doing anything else to this node? If so you probably need to put tidy underneath the other node declaration. It probably is looking for one node declaration per node and everything that needs done to it underneath versus having multiple node declaration with different resources underneath them.

edit flag offensive delete link more


I have added the other manifests file in original description

queszama gravatar imagequeszama ( 2017-04-06 06:31:53 -0500 )edit

That is your problem I believe. Remove node 10 from the myapp war resource and copy myapp war resource under the node 10 definition. That should work.

puser gravatar imagepuser ( 2017-04-06 06:47:34 -0500 )edit

You are defining node 10 twice and it doesn't like that.

puser gravatar imagepuser ( 2017-04-06 07:01:57 -0500 )edit

ok..Thanks..Got it...Is it not possible to maintain two different manifests file for the same hosts . Both the manifests file will be doing different operations.

queszama gravatar imagequeszama ( 2017-04-06 07:03:03 -0500 )edit

I don't have a lot of experience working with site.pp... I believe it works the same way as when you have two resources defined with the same name. Like you cannot have two file resources with the same namevar. You might be able to include classes and pass the node name down into them.

puser gravatar imagepuser ( 2017-04-06 07:08:25 -0500 )edit

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


Asked: 2017-04-06 04:12:28 -0500

Seen: 20 times

Last updated: Apr 06