summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2009-02-26 11:43:39 +1100
committerJames Turnbull <james@lovedthanlost.net>2009-02-26 11:43:39 +1100
commit5f73eb553fd083b558fb9553b0c07b6019d0ccee (patch)
tree123ef2a9c7b8aa4e1cd52e6b98d0b3c53d626de6 /lib/puppet/util
parente40aea3c655e698d26c29370227b52c489e6db2b (diff)
downloadpuppet-5f73eb553fd083b558fb9553b0c07b6019d0ccee.tar.gz
puppet-5f73eb553fd083b558fb9553b0c07b6019d0ccee.tar.xz
puppet-5f73eb553fd083b558fb9553b0c07b6019d0ccee.zip
Fixed #1849 - Ruby 1.9 portability: `when' doesn't like colons, replace with semicolons
Diffstat (limited to 'lib/puppet/util')
-rw-r--r--lib/puppet/util/fileparsing.rb2
-rw-r--r--lib/puppet/util/ldap/connection.rb4
-rw-r--r--lib/puppet/util/log.rb6
-rwxr-xr-xlib/puppet/util/posix.rb16
-rw-r--r--lib/puppet/util/settings.rb24
5 files changed, 26 insertions, 26 deletions
diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb
index 23d02ea60..dca0d51c0 100644
--- a/lib/puppet/util/fileparsing.rb
+++ b/lib/puppet/util/fileparsing.rb
@@ -332,7 +332,7 @@ module Puppet::Util::FileParsing
end
case record.type
- when :text: return details[:line]
+ when :text; return details[:line]
else
if record.respond_to?(:to_line)
return record.to_line(details)
diff --git a/lib/puppet/util/ldap/connection.rb b/lib/puppet/util/ldap/connection.rb
index 70fe303c5..19c53a2e6 100644
--- a/lib/puppet/util/ldap/connection.rb
+++ b/lib/puppet/util/ldap/connection.rb
@@ -62,9 +62,9 @@ class Puppet::Util::Ldap::Connection
def start
begin
case ssl
- when :tls:
+ when :tls
@connection = LDAP::SSLConn.new(host, port, true)
- when true:
+ when true
@connection = LDAP::SSLConn.new(host, port)
else
@connection = LDAP::Conn.new(host, port)
diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index a74432021..db6177be2 100644
--- a/lib/puppet/util/log.rb
+++ b/lib/puppet/util/log.rb
@@ -282,9 +282,9 @@ class Puppet::Util::Log
def colorize(level, str)
case Puppet[:color]
- when false: str
- when true, :ansi, "ansi": console_color(level, str)
- when :html, "html": html_color(level, str)
+ when false; str
+ when true, :ansi, "ansi"; console_color(level, str)
+ when :html, "html"; html_color(level, str)
end
end
diff --git a/lib/puppet/util/posix.rb b/lib/puppet/util/posix.rb
index 3f6c1f6e3..40a175eb3 100755
--- a/lib/puppet/util/posix.rb
+++ b/lib/puppet/util/posix.rb
@@ -52,8 +52,8 @@ module Puppet::Util::POSIX
# Apparently the group/passwd methods need to get reset; if we skip
# this call, then new users aren't found.
case type
- when :passwd: Etc.send(:endpwent)
- when :group: Etc.send(:endgrent)
+ when :passwd; Etc.send(:endpwent)
+ when :group; Etc.send(:endgrent)
end
return nil
end
@@ -61,8 +61,8 @@ module Puppet::Util::POSIX
# Determine what the field name is for users and groups.
def idfield(space)
case Puppet::Util.symbolize(space)
- when :gr, :group: return :gid
- when :pw, :user, :passwd: return :uid
+ when :gr, :group; return :gid
+ when :pw, :user, :passwd; return :uid
else
raise ArgumentError.new("Can only handle users and groups")
end
@@ -71,8 +71,8 @@ module Puppet::Util::POSIX
# Determine what the method is to get users and groups by id
def methodbyid(space)
case Puppet::Util.symbolize(space)
- when :gr, :group: return :getgrgid
- when :pw, :user, :passwd: return :getpwuid
+ when :gr, :group; return :getgrgid
+ when :pw, :user, :passwd; return :getpwuid
else
raise ArgumentError.new("Can only handle users and groups")
end
@@ -81,8 +81,8 @@ module Puppet::Util::POSIX
# Determine what the method is to get users and groups by name
def methodbyname(space)
case Puppet::Util.symbolize(space)
- when :gr, :group: return :getgrnam
- when :pw, :user, :passwd: return :getpwnam
+ when :gr, :group; return :getgrnam
+ when :pw, :user, :passwd; return :getpwnam
else
raise ArgumentError.new("Can only handle users and groups")
end
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index 3ef75a845..c60f1713b 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -407,11 +407,11 @@ class Puppet::Util::Settings
hash.delete(:type)
else
case hash[:default]
- when true, false, "true", "false":
+ when true, false, "true", "false"
klass = CBoolean
- when /^\$\w+\//, /^\//:
+ when /^\$\w+\//, /^\//
klass = CFile
- when String, Integer, Float: # nothing
+ when String, Integer, Float # nothing
klass = CElement
else
raise Puppet::Error, "Invalid value '%s' for %s" % [value.inspect, hash[:name]]
@@ -829,9 +829,9 @@ Generated on #{Time.now}.
def munge_value(value)
# Handle different data types correctly
return case value
- when /^false$/i: false
- when /^true$/i: true
- when /^\d+$/i: Integer(value)
+ when /^false$/i; false
+ when /^true$/i; true
+ when /^\d+$/i; Integer(value)
else
value.gsub(/^["']|["']$/,'').sub(/\s+$/, '')
end
@@ -856,13 +856,13 @@ Generated on #{Time.now}.
text.split(/\n/).each { |line|
count += 1
case line
- when /^\s*\[(\w+)\]$/:
+ when /^\s*\[(\w+)\]$/
section = $1.intern # Section names
# Add a meta section
result[section][:_meta] ||= {}
- when /^\s*#/: next # Skip comments
- when /^\s*$/: next # Skip blanks
- when /^\s*(\w+)\s*=\s*(.*)$/: # settings
+ when /^\s*#/; next # Skip comments
+ when /^\s*$/; next # Skip blanks
+ when /^\s*(\w+)\s*=\s*(.*)$/ # settings
var = $1.intern
# We don't want to munge modes, because they're specified in octal, so we'll
@@ -1150,8 +1150,8 @@ Generated on #{Time.now}.
def munge(value)
case value
- when true, "true": return true
- when false, "false": return false
+ when true, "true"; return true
+ when false, "false"; return false
else
raise ArgumentError, "Invalid value '%s' for %s" %
[value.inspect, @name]