diff options
-rwxr-xr-x | bin/cf2puppet | 186 | ||||
-rwxr-xr-x | bin/puppet | 2 | ||||
-rwxr-xr-x | bin/puppetca | 2 | ||||
-rwxr-xr-x | bin/puppetd | 2 | ||||
-rwxr-xr-x | bin/puppetdoc | 2 | ||||
-rwxr-xr-x | bin/puppetmasterd | 2 | ||||
-rwxr-xr-x | bin/puppetrun | 2 |
7 files changed, 6 insertions, 192 deletions
diff --git a/bin/cf2puppet b/bin/cf2puppet deleted file mode 100755 index 8253d8394..000000000 --- a/bin/cf2puppet +++ /dev/null @@ -1,186 +0,0 @@ -#!/usr/bin/ruby - -# -# = Synopsis -# -# Convert cfengine code to puppet code. -# -# = Usage -# -# cf2puppet [-h|--help] -o|--out <dir> <cfengine file> -# -# = Description -# -# This script reads in an entire cfengine configuration set, including -# importing necessary files, and converts it to a puppet configuration. -# -# = Options -# -# help:: -# Print this help message -# -# out:: -# Print this help message -# -# = Example -# -# $ puppetdoc > /tmp/reference.rst -# -# = Author -# -# Luke Kanies -# -# = Copyright -# -# Copyright (c) 2005 Reductive Labs, LLC -# Licensed under the GNU Public License - -require 'puppet' -require 'getoptlong' - - -module Cf2Puppet - class CfClass < Array - attr_accessor :name - end - - class CfAction - attr_accessor :name, :type - - def []=(param, value) - @params[param] = value - end - - def initialize - @params = {} - end - end - - class Parser - def initialize(file) - @file = file - @dir = File.dirname(file) - - unless FileTest.exists?(file) - $stderr.puts "%s does not exist" % file - exit(18) - end - end - - def parse - begin - File.open(@file) { |f| - str = f.read - - # get rid of comments - str.gsub(/#.+\n/) - str.gsub(/^\s*$/, '') # and blank lines - - while str do - case str - when /\A(\w+):[^:]/n: - action = $1 - end - end - f.foreach { |line| - case line.chomp - when /(\w+):\s*\n/: - $action = $1 - when /(\w+):\s*\n/: - $action = $1 - end - } - } - rescue Errno::ENOENT => detail - $stderr.puts "File %s not found" % file - return - rescue Errno::EACCES => detail - $stderr.puts "Could not open file %s" % file - return - end - end - - module Actions - def import - end - end - end -end - -$haveusage = true - -begin - require 'rdoc/usage' -rescue LoadError - $haveusage = false -end - -result = GetoptLong.new( - [ "--help", "-h", GetoptLong::NO_ARGUMENT ] -) - -out = nil - -begin - result.each { |opt,arg| - case opt - when "--out" - out = arg - when "--help" - if $haveusage - RDoc::usage && exit - else - puts "No help available unless you have RDoc::usage installed" - exit - end - end - } -rescue GetoptLong::InvalidOption => detail - $stderr.puts "Try '#{$0} --help'" - #if $haveusage - # RDoc::usage_no_exit('usage') - #end - exit(1) -end - -unless out - puts "You must specify an output directory using '-o'." - exit(12) -end - -if FileTest.exists?(out) - unless FileTest.directory?(out) - puts "%s is not a directory" % out - exit(14) - end -else - basedir = File.dirname(out) - - unless FileTest.directory?(basedir) - puts "Parent directory %s does not exist" % basedir - exit(16) - end - - Dir.mkdir(out) -end - -files = [] -if ARGV.length > 0 - files += ARGV -else - $stderr.puts "Defaulting to cfagent.conf" - files << "/var/cfengine/inputs/cfagent.conf" -end - -$stderr.puts "****WARNING**** -I can absolutely guarantee you that this script will not yet produce -an exact copy of your cfengine configuration. You _must_not_ just run -the generated configuration; check the entire configuration before -executing. This is meant as a tool for simplifying migration, not -entirely performing it. -****WARNING****" - -files.each { |file| - handle(file) -} -# $Id$ diff --git a/bin/puppet b/bin/puppet index e75e8913f..4ad3d7441 100755 --- a/bin/puppet +++ b/bin/puppet @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # # = Synopsis diff --git a/bin/puppetca b/bin/puppetca index 3b572c6e1..f725e4a8f 100755 --- a/bin/puppetca +++ b/bin/puppetca @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # # = Synopsis diff --git a/bin/puppetd b/bin/puppetd index 84c7ba758..8b0c732cf 100755 --- a/bin/puppetd +++ b/bin/puppetd @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # == Synopsis # # Retrieve the client configuration from the central puppet server and apply diff --git a/bin/puppetdoc b/bin/puppetdoc index f352e1f15..aa0b60b7b 100755 --- a/bin/puppetdoc +++ b/bin/puppetdoc @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # # = Synopsis diff --git a/bin/puppetmasterd b/bin/puppetmasterd index ff00d0c8f..3df24aa7d 100755 --- a/bin/puppetmasterd +++ b/bin/puppetmasterd @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # # = Synopsis diff --git a/bin/puppetrun b/bin/puppetrun index e2d84a784..0857f60f7 100755 --- a/bin/puppetrun +++ b/bin/puppetrun @@ -1,4 +1,4 @@ -#!/usr/bin/ruby +#!/usr/bin/env ruby # # = Synopsis |