This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <lutter> hmm .. ok; I just put a 'let _ = (print_regexp (lens_ctype values) ); print_endline ""' in there | |
| <lutter> and get | |
| <lutter> /([^\n;]|[^\n ];|;[^\n ])*( ; ([^\n;]|[^\n ];|;[^\n ])*)*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| positionable do | |
| def insync?(is) | |
| # define sync | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.8.7-p371 :001 > target = '/files/etc/toto' | |
| => "/files/etc/toto" | |
| 1.8.7-p371 :002 > spath = '/files/etc/toto/truc/IfModule[3]/directive[6]' | |
| => "/files/etc/toto/truc/IfModule[3]/directive[6]" | |
| 1.8.7-p371 :003 > spath.slice(target.length+1..-1).sub(/(.*)\/directive(?:\[\d+\])?/, '\1') | |
| => "truc/IfModule[3]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| lens { 'Shells.lns' } | |
| resource_path { |r| "$target/*[.='#{r[:name]}']" } | |
| # exists? is automatic | |
| # destroy is automatic | |
| def create | |
| augopen! { |aug| aug.set('$target/01', resource[:name]) } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Define a method using augopen | |
| # | |
| # @param [Symbol] meth the name of the method to create | |
| # @yield [aug] block that uses the Augeas handle | |
| # @yieldparam [Augeas] aug open Augeas handle | |
| # @api public | |
| def define_augmethod(meth, &block) | |
| define_method(meth) do | |
| instance_exec augopen, &block | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ rspec --color spec/unit/puppet/apache_setenv_spec.rb | |
| ....FF. | |
| Failures: | |
| 1) Puppet::Type::Apache_setenv::ProviderAugeas with simple file when update existing should update existing | |
| Failure/Error: )) | |
| expected: [] | |
| got: [wrong number of arguments (2 for 0), change from test.com to test2.com failed: wrong number of arguments (2 for 0)] (using ==) | |
| Diff: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/augtool -Asf | |
| # Loaded with -A, add association now | |
| set /augeas/load/Pg_Hba/lens Pg_Hba.lns | |
| set /augeas/load/Pg_Hba/incl /etc/postgresql/9.1/main/pg_hba.conf | |
| load | |
| # Make sure file exists | |
| defnode file /files/etc/postgresql/9.1/main/pg_hba.conf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| augeas { | |
| 'Add line if missing': | |
| context => '/files/myfile', | |
| changes => 'set 01 "subversion-1.6"', | |
| onlyif => 'match *[. =~ regex("^subversion-")] size == 0'; | |
| 'Update line if present': | |
| context => '/files/myfile', | |
| changes => 'set *[. =~ regex("^subversion-")] "subversion-1.6"', | |
| require => Augeas['Add line if missing']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Puppet::Type.type(:simpleline).provide(:augeas) do | |
| desc "Uses Augeas API to update simple line conffiles" | |
| include AugeasProviders::Provider | |
| lens { 'Simplelines.lns' } | |
| confine :feature => :augeas |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| LOGS=$1 | |
| grep scope $LOGS | awk '{print $1" "$14}' | while read f l; do | |
| echo $f: $(sed "${l}q;d" $f) | |
| done |