Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-4736

add tempfile_suffix attribute to file type

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Template:
    • Team:
      Coremunity

      Description

      It would be great if puppet had a way to control the name of temporary file that it creates as part of replacing contents of a file in File['/path/to/foo'].

      write method of Puppet::Type::File calls Puppet::Util.replace_file at https://github.com/puppetlabs/puppet/blob/master/lib/puppet/type/file.rb#L798, which creates Puppet::FileSystem::Uniquefile object at https://github.com/puppetlabs/puppet/blob/master/lib/puppet/util.rb#L351, temp file name is set by make_tmpname.

      The use case is any software that always looks on filesystem for config files in a certain directory and has an internal convention which files in that directory it will ignore.

      Surprisingly, sudo fits this description - it looks in /etc/sudoers.d and reads all files in that dir on each invocation. Sometimes, during puppet runs, it picks up files named like /etc/sudoers.d/10_foo_20150602-21614-13kol0h which is a puppet temp file.

      Sudo documentation states that it will ignore any file in /etc/sudoers.d whose name contains "." character or ends with "~" - but puppet doesn't allow to easily set these, resulting in a race condition.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            somic Dmitriy Samovskiy
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Zendesk Support