# How to declare a defined type from a .pp (say module/init.pp) file which has been defined in a different .pp (say module/folder/abc.pp) file [closed]

Below is the exact folder structure and code I am using.

Folder structure and files:

root@build-server:/etc/puppet/modules/testabc# ls -lR *
manifests:
total 8
drwxr-xr-x 2 root root 4096 Apr 17 12:07 foox
-rw-r--r-- 1 root root  286 Apr 17 12:10 init.pp

manifests/foox:
total 4
-rw-r--r-- 1 root root 79 Apr 17 11:25 fooa.pp


Puppet Code:

root@build-server:/etc/puppet/modules/testabc#cat manifests/init.pp

include testabc::foox

file {"/tmp/abc.txt":
source => 'puppet:///packages/abc.txt',
owner  => 'root',
group  => 'root',
mode   => 0644,
before  => Testabc::Foox::Fooa[$string], } class testabc { testabc ... edit retag reopen merge delete ### Closed for the following reason the question is answered, right answer was accepted by Sajauddin close date 2014-04-17 07:41:42.319907 ## 2 Answers Sort by » oldest newest most voted I would advise you to follow the default naming convention of puppet. it will avoid you to include or require the stuff. The class in manifests/foox/fooa.pp should be: define testabs::foox::fooa(...) { ... }  After that you also have other errors. Indeed you cannot declare twice the same resource: file {"/tmp/abc.txt": ... } it will fail. You have to do something like that in the define: File['/tmp/abc.txt'] { content =>$string


}

You also have to remove the before as the file will have itself as before which is not possible. Also you cannot define source and content for ...

more

Thanks for the reply and it worked for me.

more

( 2014-04-17 08:07:09 -0500 )edit

+1. Also I took the liberty to reword the question title so that it uses proper puppet nomenclature.

( 2014-04-17 08:27:37 -0500 )edit