The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Feature #2545

Ability to do "mkdir -p" with a file resource

Added by Alan Harder over 6 years ago. Updated about 6 years ago.

Status:DuplicateStart date:08/17/2009
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:file
Target version:-
Affected Puppet version:0.24.8 Branch:
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


Description

It would be nice to have “mkdir -p” ability w/o an exec resource. I was thinking this might be a good syntax:

file { '/my/path/here':
  ensure => directory,
  recurse => true
}

(if this doesn’t conflict with any other use/meaning of the recurse attribute)

Side note: I’m currently using:

exec { 'create_my_dir':
  command => 'mkdir -p /my/path/here',
  creates => '/my/path/here'
}
file { '/my/path/here/some.file':
  source => ...
}

It would be neat if the file resource here could autorequire an exec that has “create=>parent-dir” attribute, instead of only looking for File[parent-dir]. Of course, if I can do mkdir -p in a file resource I won’t need this, but thought I’d mention this idea.. probably anywhere it autorequires File[x] it could also look for Exec with creates=>x.


Related issues

Related to Puppet - Feature #86: Directory creation fails if parent directory does not exist Rejected

History

#1 Updated by Alan Harder over 6 years ago

Alan Harder wrote:

It would be neat if the file resource here could autorequire an exec that has “create=>parent-dir” attribute, instead of only looking for File[parent-dir]. Of course, if I can do mkdir -p in a file resource I won’t need this, but thought I’d mention this idea.. probably anywhere it autorequires File[x] it could also look for Exec with creates=>x.

or, as “whack” just mentioned in IRC: if “creates=>x” implicitly created a file resource under the hood, autorequires could work as they do now.

#2 Updated by Alan Harder over 6 years ago

  • Status changed from Unreviewed to Duplicate

dup of #86

Also available in: Atom PDF