A small follow up: the gem has just been pushed to rubygems, and you can read more about the motivation for this at http://santanatechnotes.blogspot.mx/2013/04/puppet-cleaner-010-released.html
El martes, 16 de abril de 2013 17:31:38 UTC-5, Gerardo Santana Gómez Garrido escribió: > > FWIW, > > I've wrote puppet-cleaner to help me make comply thousands of lines of > puppet 2.6 DSL code to puppet 2.7 style guide and expectations. I'm > uploading it to github today for anyone to use. > > https://github.com/santana/puppet-cleaner > > Externally, you run puppet-clean file.pp and it can transform this: > > /* > multiline comment > trailing white space here -> > */ > > class someclass($version = "5", $platform = "rhel6") > { > if ! ($version in ["4", "5"] or !($platform in ["rhel5", "rhel6"])) { > fail("Version $version on $platform is not supported") > } > else { > notice("Defining class for version \"$version\" on '$platform'") > package { > [ > "package-1", > "package-2", > ]: > } > > sysctl2::conf {"${something}": > settings => [ > "set key1 'value1'", > "set key2 'value2'", > ] > } > file { > "/file/a": # test > source => 'puppet:///someclass/file/a', > owner => 'root', > ensure => ensure_a, > group=> "${group}"; > "/file/b": > source => 'puppet:///someclass/file/b', > mode=>755, > ensure => ensure_b, > owner => 'root', > group=> "${group}"; > } > > file { > "/file/c": > source => 'puppet:///someclass/file/c', > owner => 'root', > ensure => ensure_c, > group=> "${group}"; > "/file/d": > source => 'puppet:///someclass/file/d', > mode=>"755", > owner => 'root', > group=> "${group}" > } > file { > "/file/e": > source => 'puppet:///someclass/file/c', > owner => 'root', > alias => ["$hostname"], > group=> "${group}", > ensure => 'absent'; > "/file/f": > ensure => 'ensure_f'; > } > > user { > "jdoe": > managed_home => "true", > } > } > } > > into this: > > # > # multiline comment > # trailing white space here -> > > > class someclass($version = '5', $platform = 'rhel6') > { > if ! ($version in ['4', '5'] or !($platform in ['rhel5', 'rhel6'])) { > fail("Version ${version} on ${platform} is not supported") > } > else { > notice("Defining class for version \"${version}\" on '${platform}'") > package { > [ > 'package-1', > 'package-2', > ]: > } > > sysctl2::conf {$something: > settings => [ > 'set key1 \'value1\'', > 'set key2 \'value2\'', > ] > } > file { > '/file/a': > ensure => link, # test > source => 'puppet:///someclass/file/a', > owner => 'root', > target => ensure_a, > group => $group; > '/file/b': > ensure => link, > source => 'puppet:///someclass/file/b', > mode => '0755', > target => ensure_b, > owner => 'root', > group => $group; > } > > file { > '/file/c': > ensure => link, > source => 'puppet:///someclass/file/c', > owner => 'root', > target => ensure_c, > group => $group; > '/file/d': > source => 'puppet:///someclass/file/d', > mode => '0755', > owner => 'root', > group => $group > } > file { > '/file/e': > ensure => 'absent', > source => 'puppet:///someclass/file/c', > owner => 'root', > alias => [$hostname], > group => $group; > '/file/f': > ensure => link, > target => 'ensure_f'; > } > > user { > 'jdoe': > managed_home => true, > } > } > } > > Internally, it monkey patches puppet 2.7.11 to take advantage of puppet's > tokenizer and iterates over them like in a production line, where each > transformation algorithm (worker) awaits for the pattern of tokens it knows > how to transform. > > I haven't had the time to refactor some stuff; feel free to ignore it, > improve it, send me patches, etc. > > > -- 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+unsubscr...@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.