Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 15, 2014

Conversation

stbenjam
Copy link
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

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

apenney commented May 15, 2014

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

@stbenjam
Copy link
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