FAQ
I'm hoping a commonly used module that provides a resource for managing
multiple contiguous lines in a file already exists and someone can point me
to it. I want something like the file_line type in the puppet labs stdlib
module but have it check multiple lines instead of just one.

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

Search Discussions

  • Paul Tötterman at May 6, 2013 at 7:55 am
    Hi,
    On Sunday, May 5, 2013 2:25:02 AM UTC+3, Schofield wrote:

    I'm hoping a commonly used module that provides a resource for managing
    multiple contiguous lines in a file already exists and someone can point me
    to it. I want something like the file_line type in the puppet labs stdlib
    module but have it check multiple lines instead of just one.
    Have you looked at using templates? If not, then do that first. In case
    templates don't work out, maybe the concat module does:
    https://github.com/ripienaar/puppet-concat

    Cheers,
    Paul

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jcbollinger at May 6, 2013 at 1:27 pm

    On Monday, May 6, 2013 2:55:33 AM UTC-5, Paul Tötterman wrote:
    Hi,
    On Sunday, May 5, 2013 2:25:02 AM UTC+3, Schofield wrote:

    I'm hoping a commonly used module that provides a resource for managing
    multiple contiguous lines in a file already exists and someone can point me
    to it. I want something like the file_line type in the puppet labs stdlib
    module but have it check multiple lines instead of just one.
    Have you looked at using templates? If not, then do that first. In case
    templates don't work out, maybe the concat module does:
    https://github.com/ripienaar/puppet-concat
    Indeed, templates and Concat, either individually or in combination, are
    great tools for managing files, including where responsibility for
    different pieces of the file is spread across multiple classes.
    Unfortunately, none of that is really analogous to Stdlib::File_line, which
    manages *just* one line in a file, without managing the rest of the file's
    content. That's a pretty strange thing to do in the Puppet scheme of
    things, actually, but I suppose it can be useful.

    I am not aware of any existing, publicly available module providing a type
    that manages blocks of lines in a manner analogous to Stdlib::File_line.
    There are several possible approaches that might work instead, depending on
    the details of the problem, among them:

        - Manage the whole file (best, if it is feasible). Templates and/or
        Concat fit right into this.
        - Put everything on one line and manage it via Stdlib::File_line. That
        assumes the line breaks are optional (or can be replaced with something
        else), which is often true, but not always.
        - Put the managed content in a separate, wholly-managed file, and
        include it into the target via a target-specific inclusion feature. For
        instance, some configuration file languages have an 'include' statement
        that interpolates external files (much like the C preprocessor's #include
        directive). Better, some programs automatically read all files from a
        given directory.

    If none of those are suitable then it's a very unusual case; the best
    available option may then be to build what you need yourself.


    John

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Schofield at May 6, 2013 at 3:06 pm

    Indeed, templates and Concat, either individually or in combination, are
    great tools for managing files, including where responsibility for
    different pieces of the file is spread across multiple classes.
    This is exactly my situation. I need multiple other modules to contribute
    multiple lines to the file.

    Unfortunately, none of that is really analogous to Stdlib::File_line,
    which manages *just* one line in a file, without managing the rest of the
    file's content. That's a pretty strange thing to do in the Puppet scheme
    of things, actually, but I suppose it can be useful.

    I am not aware of any existing, publicly available module providing a type
    that manages blocks of lines in a manner analogous to Stdlib::File_line.
    There are several possible approaches that might work instead, depending on
    the details of the problem, among them:

    - Manage the whole file (best, if it is feasible). Templates and/or
    Concat fit right into this.

    I would like to use templates if possible but what I have not figured out
    yet is how to provide the lines from different modules during the catalog
    compile. Is it possible to send the lines from multiple modules to another
    and guarantee that the module managing the file has received all the
    lines? My understanding is that puppet does not guarantee ordering during
    the catalog compile.
    - Put everything on one line and manage it via Stdlib::File_line.
    That assumes the line breaks are optional (or can be replaced with
    something else), which is often true, but not always.
    - Put the managed content in a separate, wholly-managed file, and
    include it into the target via a target-specific inclusion feature. For
    instance, some configuration file languages have an 'include' statement
    that interpolates external files (much like the C preprocessor's #include
    directive). Better, some programs automatically read all files from a
    given directory.

    If none of those are suitable then it's a very unusual case; the best
    available option may then be to build what you need yourself.


    John
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Jcbollinger at May 7, 2013 at 1:10 pm

    On Monday, May 6, 2013 10:06:20 AM UTC-5, Schofield wrote:
    Indeed, templates and Concat, either individually or in combination, are
    great tools for managing files, including where responsibility for
    different pieces of the file is spread across multiple classes.
    This is exactly my situation. I need multiple other modules to contribute
    multiple lines to the file.

    Unfortunately, none of that is really analogous to Stdlib::File_line,
    which manages *just* one line in a file, without managing the rest of
    the file's content. That's a pretty strange thing to do in the Puppet
    scheme of things, actually, but I suppose it can be useful.

    I am not aware of any existing, publicly available module providing a
    type that manages blocks of lines in a manner analogous to
    Stdlib::File_line. There are several possible approaches that might work
    instead, depending on the details of the problem, among them:

    - Manage the whole file (best, if it is feasible). Templates and/or
    Concat fit right into this.

    I would like to use templates if possible but what I have not figured out
    yet is how to provide the lines from different modules during the catalog
    compile. Is it possible to send the lines from multiple modules to another
    and guarantee that the module managing the file has received all the
    lines? My understanding is that puppet does not guarantee ordering during
    the catalog compile.
    It sounds like the Concat module may be just what you're looking for,
    provided that amongst all the relevant classes you are ultimately managing
    the entire file. Compilation order is not relevant here, as it has no
    effect on the order in which fragments might be assembled into the final
    file, but Concat does provide means to control the relative order of the
    fragments. Here's the module URL on the Forge:
    https://forge.puppetlabs.com/ripienaar/concat.


    John



    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Ashley Penney at May 6, 2013 at 1:56 pm

    On Sat, May 4, 2013 at 7:25 PM, Schofield wrote:

    I'm hoping a commonly used module that provides a resource for managing
    multiple contiguous lines in a file already exists and someone can point me
    to it. I want something like the file_line type in the puppet labs stdlib
    module but have it check multiple lines instead of just one.
    This feels like it would be a natural fit to be modeled in augeas (unless I
    misunderstand your requirements), which is designed for exactly this kind
    of line by line control of files. For an example you can look at
    https://forge.puppetlabs.com/domcleal/augeasproviders for some providers
    Dominic has written.

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMay 4, '13 at 11:25p
activeMay 7, '13 at 1:10p
posts6
users4
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase