Error saying "File[/etc/httpd/conf/mods-enabled/proxy.conf] is already defined; cannot redefined"

0 votes

I'm trying to inherit a module using Puppet

class apache::proxy {
file { '/etc/httpd/conf/mods-enabled/proxy.conf':
source => "puppet:///modules/apache/proxy.conf"
}

Defined my own version:

class myapp {
include apache::proxy
file { '/etc/httpd/conf/mods-enabled/proxy.conf':
source => "puppet:///services/myapp/proxy.conf"
}

It keeps throwing this error:

File[/etc/httpd/conf/mods-enabled/proxy.conf] is already defined; cannot redefined

What do I do?

Mar 5 in Puppet by Kavya
28 views

2 answers to this question.

0 votes

You can override resources with class inheritance by creating a subclass that inherits resources from the parent class.

class myapp::apache inherits apache::proxy {
file { '/etc/httpd/conf/mods-enabled/proxy.conf':
source => "puppet:///services/myapp/proxy.conf"
}

Then instead of calling the class with the statement include apache::proxy you call the override class with the statement include myapp::apache in the service manifest.

answered Mar 5 by Yogesh
0 votes
This error occurs when you try to create a service stack from reusable Puppet modules and try altering a resource that has already been defined in the previous module.
answered Mar 5 by Kyraa

Related Questions In Puppet

0 votes
1 answer

Pupper error - Duplicate definition: Service[ServiceName] is already defined

Hey @Nigya, try something like this: class MyClass ...READ MORE

answered Feb 14 in Puppet by Hatim
31 views
0 votes
1 answer

Puppet: Error: Cannot set modulepath settings in puppet.conf

These extra module paths are specific to ...READ MORE

answered Aug 7 in Puppet by Sirajul
• 36,620 points
100 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
209 views
0 votes
1 answer
0 votes
1 answer

Service already defines error in Puppet

Hey @Rohan, try this: class MyClass { ...READ MORE

answered Feb 9 in Puppet by Monish
56 views