Hi,
I'm using ubuntu 14.04 and puppet version 3.4.3 for both master and agent.
Say currently there are no folders or file inside agent's /tmp/ directory.
When attempting to create a directory structure as follows,
# create a directory
file { "/tmp/dbscripts/mysql/":
ensure => "directory",
}
Error thrown saying,
root@elb-1:~# puppet agent -t
Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/java_home.rb
Info: Caching catalog for elb-1.openstacklocal
Info: Applying configuration version '1420519752'
*Error: Cannot create /tmp/dbscripts/mysql; parent directory /tmp/dbscripts
does not exist*
Error: /Stage[main]/Main/Node[elb-1]/File[/tmp/dbscripts/mysql/]/ensure:
change from absent to directory failed: Cannot create /tmp/dbscripts/mysql;
parent directory /tmp/dbscripts does not exist
Notice: /Stage[main]/Main/Node[elb-1]/File[/tmp/dbscripts/mysql/welcome
file.xml]: Dependency File[/tmp/dbscripts/mysql/] has failures: true
Warning: /Stage[main]/Main/Node[elb-1]/File[/tmp/dbscripts/mysql/welcome
file.xml]: Skipping because of failed dependencies
Notice: Finished catalog run in 0.06 seconds
There is a Feature logged in puppetlabs (Feature #86) to address this issue
[1].
Workaround provided by puppetlabs is as follows.
# create a directory
file {['/tmp/dbscripts','/tmp/dbscripts/mysql']:
ensure => "directory",
}
It is successful.
When more number of non-existing parent directories present in the path,
more array elements to be given.
file {['/top','/top/second','/top/second/deep','/top/second/deep/deepest']:
ensure => directory
}
We are planning to parameterise the path of the directories to be created.
After parameterising if we do as above workaround, we have to retrieve the
path and break down it into an array as above and then create the folder
structure.
Is there a better, cleaner puppet workaround than the given one above?
[1] http://projects.puppetlabs.com/issues/86
[2]
https://github.com/ghoneycutt/puppet-module-common/blob/master/manifests/mkdir_p.pp
Thanks,
Suhan
--
Suhan Dharmasuriya
Software Engineer - Test Automation
*WSO2, Inc. *
lean . enterprise . middleware
Tel: +94 112 145345
Mob: +94 779 869138
Blog: http://suhan-opensource.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev