Hi, I am trying to import some manifests manually (outside the modules tree) and it does not seem to work fine. I have the files: manifests/site.pp manifests/data/file1.pp Inside site.pp I do: import "data/file1.pp" And that doesn''t work. But if I rename data/file1.pp by data_file1.pp, and place it in the same directory as site.pp (so, no subdirectories), it works. I was reading the language guide, and it seems like "import" should work the way I use it, but it does not, at least in my case. Any clue? Thanks, Pablo -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Peter Bukowinski
2012-Mar-20 17:42 UTC
Re: [Puppet Users] import manifest inside subdirectory
On Mar 20, 2012, at 12:47 PM, Pablo Fernandez wrote:> Hi, > > I am trying to import some manifests manually (outside the modules tree) and it does not seem to work fine. I have the files: > manifests/site.pp > manifests/data/file1.pp > > Inside site.pp I do: > import "data/file1.pp" > > And that doesn''t work. But if I rename data/file1.pp by data_file1.pp, and place it in the same directory as site.pp (so, no subdirectories), it works. > > I was reading the language guide, and it seems like "import" should work the way I use it, but it does not, at least in my case. > > Any clue? > > Thanks, > PabloIndividual files can only be imported from the same directory as the site.pp. If you want to import from a subdirectory you''ll need use globbing: import ''data/*'' This is covered in the Importing Manifests section of the language guide. http://docs.puppetlabs.com/guides/language_guide.html#importing-manifests -- Peter M. Bukowinski Sr. Systems Engineer Janelia Farm Research Campus, HHMI -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mar 20, 11:47 am, Pablo Fernandez <pablo.fernan...@cscs.ch> wrote:> Hi, > > I am trying to import some manifests manually (outside the modules tree) and > it does not seem to work fine.Would you care to talk about why you want to do this? I know exactly one good use case for the ''import'' statement, and it''s not your case. There is probably a better way to achieve your goal. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Pablo Fernandez
2012-Mar-21 14:25 UTC
Re: [Puppet Users] Re: import manifest inside subdirectory
Hi,> > I am trying to import some manifests manually (outside the modules tree) > > and it does not seem to work fine. > Would you care to talk about why you want to do this? I know exactly > one good use case for the ''import'' statement, and it''s not your case. > There is probably a better way to achieve your goal.The idea is to separate the data from Hiera away from the modules directory. I am using the hiera-puppet backend, without the yaml backend. So, I have found that the :hierarchy: allows me to have the data inside a module itself. According to the example inside hiera-puppet module, if you define: :backends: - puppet :hierarchy: - %{location} - %{environment} - common :puppet: :datasource: data Then the hiera data is searched within: * class data::dc2 * class data::production * class data::common * class ntp::config::data * class ntp::data Which is exactly what I wanted to do... but I did not want to have the "data" module with the rest of the modules (it''s hiera data anyway) so I created a directory manifests/data to put those files. Maybe I should have called hiera, but data is just fine. It is not imported automatically, so those files need to be imported by hand. And if I use globbing, I may have surprises later because of that known problem with globbing (that require a touch on the site.pp). If there is a more elegant way to proceed, I''m happy to hear! BR/Pablo -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mar 21, 9:25 am, Pablo Fernandez <pablo.fernan...@cscs.ch> wrote:> Hi, > > > > I am trying to import some manifests manually (outside the modules tree) > > > and it does not seem to work fine. > > Would you care to talk about why you want to do this? I know exactly > > one good use case for the ''import'' statement, and it''s not your case. > > There is probably a better way to achieve your goal. > > The idea is to separate the data from Hiera away from the modules directory. I > am using the hiera-puppet backend, without the yaml backend. So, I have found > that the :hierarchy: allows me to have the data inside a module itself. > > According to the example inside hiera-puppet module, if you define: > > :backends: - puppet > :hierarchy: - %{location} > - %{environment} > - common > :puppet: > :datasource: data > > Then the hiera data is searched within: > > * class data::dc2 > * class data::production > * class data::common > * class ntp::config::data > * class ntp::data > > Which is exactly what I wanted to do... but I did not want to have the "data" > module with the rest of the modules (it''s hiera data anyway) so I created a > directory manifests/data to put those files. Maybe I should have called hiera, > but data is just fine. It is not imported automatically, so those files need > to be imported by hand. And if I use globbing, I may have surprises later > because of that known problem with globbing (that require a touch on the > site.pp). > > If there is a more elegant way to proceed, I''m happy to hear!Have you tried creating a separate module directory for your data modules and adding it to Puppet''s module path? That way you should be able to separate your data classes from the others while still getting all the advantages of Puppet autoloading. I confess that I find it a bit strange, however, that you want to separate module data so completely from the rest of the module while using Hiera''s Puppet backend. It runs rather against the idea of modules as self-contained entities. Even with the YAML backend I might expect module-specific data to be located within modules'' own directory tree. It''s a good idea to separate data from declarations, but I''m not so keen on pulling the data entirely out of its context. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Pablo Fernandez
2012-Mar-21 14:57 UTC
Re: [Puppet Users] Re: import manifest inside subdirectory
Hi,> I confess that I find it a bit strange, however, that you want to > separate module data so completely from the rest of the module while > using Hiera''s Puppet backend. It runs rather against the idea of > modules as self-contained entities. Even with the YAML backend I > might expect module-specific data to be located within modules'' own > directory tree. It''s a good idea to separate data from declarations, > but I''m not so keen on pulling the data entirely out of its context.Yes... I guess it''s a weird case of module, since it''s not going to be included by any class, but still has the syntax of a module. I consider it more like the YAML tree, that sits completely outside of the modules (with an addition... you can use conditionals!!!). I would rather organize the tree following the logic more than the syntax. Also, if I extend the module path, I will have to either: - include /etc/puppet/manifests as a module path, which is probably not a good idea - or create an additional level on the tree: /etc/puppet/manifests/data/data/, which is ugly. I feel better using the manual import, or globbing, if this becomes too big. Thanks for the hints! Pablo -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.