Ask Your Question

How to handle folder or file name with "environment" in puppet

asked 2016-05-26 06:26:51 -0600

yoga gravatar image

Explain me about to handle the name "environment" in puppet?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-05-26 20:24:16 -0600

DarylW gravatar image

updated 2016-05-26 21:36:37 -0600

There shouldn't be any problem creating a file or directory named environment.

ubuntu:~$ puppet apply -e 'file{ "/tmp/environment": ensure => "directory", }'
Notice: Compiled catalog for ubuntu in environment production in 0.09 seconds
Notice: /Stage[main]/Main/File[/tmp/environment]/ensure: created
Notice: Applied catalog in 0.02 seconds
ubuntu:~$ sudo puppet resource file /tmp/environment
file { '/tmp/environment':
  ensure => 'directory',
  ctime  => '2016-05-26 21:20:55 -0400',
  group  => '1000',
  mode   => '0775',
  mtime  => '2016-05-26 21:20:55 -0400',
  owner  => '1000',
  type   => 'directory',

There is already a variable $environment which relates to the 'puppet' environment that you are currently executing from. You'll just have to use a different variable name. It is one of the reserved words... read more about them here...

Several words in the Puppet language are reserved. This means they:

Cannot be used as bare word strings — you must quote these words if you wish to use them as strings. Cannot be used as names for custom functions. Cannot be used as names for classes. Cannot be used as names for custom resource types or defined resource types.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-05-26 06:26:51 -0600

Seen: 55 times

Last updated: May 26 '16