FAQ

[Puppet-dev] Puppet::Util.replace_file vs Puppet::Util::FileLocking

Trevor Vaughan
Jun 25, 2013 at 1:36 pm
So, what's better to use and why, Puppet::Util.replace_file or
Puppet::Util::FileLocking?

Thanks,

Trevor

--
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tva...@...com

-- This account not approved for unencrypted proprietary information --

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-dev@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-dev.
For more options, visit https://groups.google.com/groups/opt_out.
reply

Search Discussions

4 responses

  • Andy Parker at Jun 25, 2013 at 4:48 pm
    They are for different purposes. If you want to securely and atomically
    replace the contents of a file then you use #replace_file. If you want to
    use a locking mechanism that another process can interact with, then you
    want Puppet::Util::FileLock.

    On Tue, Jun 25, 2013 at 6:36 AM, Trevor Vaughan wrote:

    So, what's better to use and why, Puppet::Util.replace_file or
    Puppet::Util::FileLocking?

    Thanks,

    Trevor

    --
    Trevor Vaughan
    Vice President, Onyx Point, Inc
    (410) 541-6699
    tva...@...com

    -- This account not approved for unencrypted proprietary information --

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.



    --
    Andrew Parker
    and...@...com
    Freenode: zaphod42
    Twitter: @aparker42
    Software Developer

    *Join us at PuppetConf 2013, August 22-23 in San Francisco - *
    http://bit.ly/pupconf13*
    **Register now and take advantage of the Early Bird discount - save 25%!*

    --
    You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Trevor Vaughan at Jun 25, 2013 at 7:56 pm
    +1 for comments :-D.

    Thanks Andy.

    I filed two related bugs in that they don't preserve SELinux contexts.
    Debugging that is extra exciting.

    Trevor

    On Tue, Jun 25, 2013 at 12:48 PM, Andy Parker wrote:

    They are for different purposes. If you want to securely and atomically
    replace the contents of a file then you use #replace_file. If you want to
    use a locking mechanism that another process can interact with, then you
    want Puppet::Util::FileLock.

    On Tue, Jun 25, 2013 at 6:36 AM, Trevor Vaughan wrote:

    So, what's better to use and why, Puppet::Util.replace_file or
    Puppet::Util::FileLocking?

    Thanks,

    Trevor

    --
    Trevor Vaughan
    Vice President, Onyx Point, Inc
    (410) 541-6699
    tva...@...com

    -- This account not approved for unencrypted proprietary information --

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.



    --
    Andrew Parker
    and...@...com
    Freenode: zaphod42
    Twitter: @aparker42
    Software Developer

    *Join us at PuppetConf 2013, August 22-23 in San Francisco - *
    http://bit.ly/pupconf13*
    **Register now and take advantage of the Early Bird discount - save 25%!*

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.



    --
    Trevor Vaughan
    Vice President, Onyx Point, Inc
    (410) 541-6699
    tva...@...com

    -- This account not approved for unencrypted proprietary information --

    --
    You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Josh Cooper at Jun 25, 2013 at 8:49 pm

    On Tue, Jun 25, 2013 at 12:56 PM, Trevor Vaughan wrote:

    +1 for comments :-D.

    Thanks Andy.

    I filed two related bugs in that they don't preserve SELinux contexts.
    Debugging that is extra exciting.

    Trevor

    On Tue, Jun 25, 2013 at 12:48 PM, Andy Parker wrote:

    They are for different purposes. If you want to securely and atomically
    replace the contents of a file then you use #replace_file. If you want to
    use a locking mechanism that another process can interact with, then you
    want Puppet::Util::FileLock.

    On Tue, Jun 25, 2013 at 6:36 AM, Trevor Vaughan wrote:

    So, what's better to use and why, Puppet::Util.replace_file or
    Puppet::Util::FileLocking?

    Thanks,

    Trevor

    --
    Trevor Vaughan
    Vice President, Onyx Point, Inc
    (410) 541-6699
    tva...@...com

    -- This account not approved for unencrypted proprietary information --

    --
    You received this message because you are subscribed to the Google
    Groups "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.



    --
    Andrew Parker
    and...@...com
    Freenode: zaphod42
    Twitter: @aparker42
    Software Developer

    *Join us at PuppetConf 2013, August 22-23 in San Francisco - *
    http://bit.ly/pupconf13*
    **Register now and take advantage of the Early Bird discount - save 25%!*

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.



    --
    Trevor Vaughan
    Vice President, Onyx Point, Inc
    (410) 541-6699
    tva...@...com

    -- This account not approved for unencrypted proprietary information --

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.

    If only puppet had a filesystem abstraction layer, then selinux and windows
    would be easier to support.

    Josh

    --
    Josh Cooper
    Developer, Puppet Labs

    *Join us at PuppetConf 2013, August 22-23 in San Francisco - *
    http://bit.ly/pupconf13*
    **Register now and take advantage of the Early Bird discount - save 25%!*

    --
    You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Trevor Vaughan at Jun 25, 2013 at 10:15 pm
    In this case, the Puppet::Util::SELInux code has everything necessary to
    wrap the call and works correctly with nil values.

    But yes, knowing what filesystem you were on and being able to handle it
    accordingly would be nice.

    Trevor

    On Tue, Jun 25, 2013 at 4:48 PM, Josh Cooper wrote:



    On Tue, Jun 25, 2013 at 12:56 PM, Trevor Vaughan wrote:

    +1 for comments :-D.

    Thanks Andy.

    I filed two related bugs in that they don't preserve SELinux contexts.
    Debugging that is extra exciting.

    Trevor

    On Tue, Jun 25, 2013 at 12:48 PM, Andy Parker wrote:

    They are for different purposes. If you want to securely and atomically
    replace the contents of a file then you use #replace_file. If you want to
    use a locking mechanism that another process can interact with, then you
    want Puppet::Util::FileLock.

    On Tue, Jun 25, 2013 at 6:36 AM, Trevor Vaughan wrote:

    So, what's better to use and why, Puppet::Util.replace_file or
    Puppet::Util::FileLocking?

    Thanks,

    Trevor

    --
    Trevor Vaughan
    Vice President, Onyx Point, Inc
    (410) 541-6699
    tva...@...com

    -- This account not approved for unencrypted proprietary information --

    --
    You received this message because you are subscribed to the Google
    Groups "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.



    --
    Andrew Parker
    and...@...com
    Freenode: zaphod42
    Twitter: @aparker42
    Software Developer

    *Join us at PuppetConf 2013, August 22-23 in San Francisco - *
    http://bit.ly/pupconf13*
    **Register now and take advantage of the Early Bird discount - save 25%!
    *

    --
    You received this message because you are subscribed to the Google
    Groups "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.



    --
    Trevor Vaughan
    Vice President, Onyx Point, Inc
    (410) 541-6699
    tva...@...com

    -- This account not approved for unencrypted proprietary information --

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.

    If only puppet had a filesystem abstraction layer, then selinux and
    windows would be easier to support.

    Josh

    --
    Josh Cooper
    Developer, Puppet Labs

    *Join us at PuppetConf 2013, August 22-23 in San Francisco - *
    http://bit.ly/pupconf13*
    **Register now and take advantage of the Early Bird discount - save 25%!*

    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.



    --
    Trevor Vaughan
    Vice President, Onyx Point, Inc
    (410) 541-6699
    tva...@...com

    -- This account not approved for unencrypted proprietary information --

    --
    You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-dev@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-dev.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post