Skip to content

(PUP-2571) add 'before' functionality to file_line#256

Merged
apenney merged 1 commit intopuppetlabs:masterfrom
stbenjam:2571-before
May 15, 2014
Merged

(PUP-2571) add 'before' functionality to file_line#256
apenney merged 1 commit intopuppetlabs:masterfrom
stbenjam:2571-before

Conversation

@stbenjam
Copy link
Copy Markdown
Contributor

file_line supports adding lines after a match, but there are use cases when
having "before" would be useful. For example, in Debian-based OS's, the last
line of /etc/rc.local is "exit 0" it's an incredible pain to deal with
that scenario today.

This commit adds a 'before' parameter to the file_line type, and implements
it for the ruby provider.

file_line supports adding lines after a match, but there are use cases when
having "before" would be useful. For example, in Debian-based OS's, the last
line of /etc/rc.local is "exit 0" it's an incredible pain to deal with
that scenario today.

This commit adds a 'before' parameter to the file_line type, and implements
it for the ruby provider.
apenney pushed a commit that referenced this pull request May 15, 2014
(PUP-2571) add 'before' functionality to file_line
@apenney apenney merged commit 8499ebd into puppetlabs:master May 15, 2014
apenney pushed a commit that referenced this pull request May 15, 2014
Revert "Merge pull request #256 from stbenjam/2571-before"
@apenney
Copy link
Copy Markdown

apenney commented May 15, 2014

#257 <-- I just had to revert this, it causes puppetlabs-apache tests to fail with:

  1. apache::mod::proxy_html on a FreeBSD OS should compile the catalogue without cycles
    Failure/Error: it { should compile.with_all_deps }
    NoMethodError:
    undefined method `to_edges' for #Puppet::Type::File_line::ParameterBefore:0x7fe07e3e1b90

@apenney
Copy link
Copy Markdown

apenney commented May 15, 2014

We saw this on Puppet 2.7, so its probably just an issue there.

@stbenjam
Copy link
Copy Markdown
Contributor Author

@apenney Oops, sorry about that! I didn't even realize this, but "before" is a bad name because of resource ordering. That's what's breaking puppetlabs-apache (and probably a bunch of other things).

Renaming this to 'precede' fixes the puppetlabs-apache tests. I'm not sure I like "precede" though :-(

I'd rather the structure be something like this with positon being before, after, or overwrite. That's too big of a change I guess.

file_line { "nisdomain_live":
  path     => '/etc/rc.local',
  match    => '^exit 0$',
  position => before, 
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants