summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network
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/network
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/network')
-rw-r--r--lib/puppet/network/authconfig.rb12
-rwxr-xr-xlib/puppet/network/authstore.rb14
-rwxr-xr-xlib/puppet/network/handler/fileserver.rb14
-rw-r--r--lib/puppet/network/handler/master.rb4
-rwxr-xr-xlib/puppet/network/handler/resource.rb6
-rw-r--r--lib/puppet/network/http.rb4
6 files changed, 27 insertions, 27 deletions
diff --git a/lib/puppet/network/authconfig.rb b/lib/puppet/network/authconfig.rb
index 8e3773719..dc67723c4 100644
--- a/lib/puppet/network/authconfig.rb
+++ b/lib/puppet/network/authconfig.rb
@@ -99,9 +99,9 @@ module Puppet
count = 1
f.each { |line|
case line
- when /^\s*#/: next # skip comments
- when /^\s*$/: next # skip blank lines
- when /\[([\w.]+)\]/: # "namespace" or "namespace.method"
+ when /^\s*#/; next # skip comments
+ when /^\s*$/; next # skip blank lines
+ when /\[([\w.]+)\]/ # "namespace" or "namespace.method"
name = $1
if newrights.include?(name)
raise FileServerError, "%s is already set at %s" %
@@ -109,11 +109,11 @@ module Puppet
end
newrights.newright(name)
right = newrights[name]
- when /^\s*(\w+)\s+(.+)$/:
+ when /^\s*(\w+)\s+(.+)$/
var = $1
value = $2
case var
- when "allow":
+ when "allow"
value.split(/\s*,\s*/).each { |val|
begin
right.info "allowing %s access" % val
@@ -123,7 +123,7 @@ module Puppet
[detail.to_s, count, @config]
end
}
- when "deny":
+ when "deny"
value.split(/\s*,\s*/).each { |val|
begin
right.info "denying %s access" % val
diff --git a/lib/puppet/network/authstore.rb b/lib/puppet/network/authstore.rb
index cb1fdc57d..7341f8a1e 100755
--- a/lib/puppet/network/authstore.rb
+++ b/lib/puppet/network/authstore.rb
@@ -174,7 +174,7 @@ module Puppet
# Mapping a type of statement into a return value.
def result
case @type
- when :allow: true
+ when :allow; true
else
false
end
@@ -243,16 +243,16 @@ module Puppet
# statement it is. The output of this is used for later matching.
def parse(value)
case value
- when /^(\d+\.){1,3}\*$/: # an ip address with a '*' at the end
+ when /^(\d+\.){1,3}\*$/ # an ip address with a '*' at the end
@name = :ip
match = $1
match.sub!(".", '')
ary = value.split(".")
mask = case ary.index(match)
- when 0: 8
- when 1: 16
- when 2: 24
+ when 0; 8
+ when 1; 16
+ when 2; 24
else
raise AuthStoreError, "Invalid IP pattern %s" % value
end
@@ -269,10 +269,10 @@ module Puppet
rescue ArgumentError => detail
raise AuthStoreError, "Invalid IP address pattern %s" % value
end
- when /^([a-zA-Z][-\w]*\.)+[-\w]+$/: # a full hostname
+ when /^([a-zA-Z][-\w]*\.)+[-\w]+$/ # a full hostname
@name = :domain
@pattern = munge_name(value)
- when /^\*(\.([a-zA-Z][-\w]*)){1,}$/: # *.domain.com
+ when /^\*(\.([a-zA-Z][-\w]*)){1,}$/ # *.domain.com
@name = :domain
@pattern = munge_name(value)
@pattern.pop # take off the '*'
diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb
index b39396091..86b0b5bb6 100755
--- a/lib/puppet/network/handler/fileserver.rb
+++ b/lib/puppet/network/handler/fileserver.rb
@@ -278,9 +278,9 @@ class Puppet::Network::Handler
count = 1
f.each { |line|
case line
- when /^\s*#/: next # skip comments
- when /^\s*$/: next # skip blank lines
- when /\[([-\w]+)\]/:
+ when /^\s*#/; next # skip comments
+ when /^\s*$/; next # skip blank lines
+ when /\[([-\w]+)\]/
name = $1
if newmounts.include?(name)
raise FileServerError, "%s is already mounted at %s" %
@@ -288,11 +288,11 @@ class Puppet::Network::Handler
end
mount = Mount.new(name)
newmounts[name] = mount
- when /^\s*(\w+)\s+(.+)$/:
+ when /^\s*(\w+)\s+(.+)$/
var = $1
value = $2
case var
- when "path":
+ when "path"
if mount.name == MODULES
Puppet.warning "The '#{mount.name}' module can not have a path. Ignoring attempt to set it"
else
@@ -304,7 +304,7 @@ class Puppet::Network::Handler
newmounts.delete(mount.name)
end
end
- when "allow":
+ when "allow"
value.split(/\s*,\s*/).each { |val|
begin
mount.info "allowing %s access" % val
@@ -314,7 +314,7 @@ class Puppet::Network::Handler
count, @configuration.file)
end
}
- when "deny":
+ when "deny"
value.split(/\s*,\s*/).each { |val|
begin
mount.info "denying %s access" % val
diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb
index 7bde0af73..0d36c1e88 100644
--- a/lib/puppet/network/handler/master.rb
+++ b/lib/puppet/network/handler/master.rb
@@ -65,9 +65,9 @@ class Puppet::Network::Handler
catalog = Puppet::Resource::Catalog.find(client)
case format
- when "yaml":
+ when "yaml"
return CGI.escape(catalog.extract.to_yaml(:UseBlock => true))
- when "marshal":
+ when "marshal"
return CGI.escape(Marshal.dump(catalog.extract))
else
raise "Invalid markup format '%s'" % format
diff --git a/lib/puppet/network/handler/resource.rb b/lib/puppet/network/handler/resource.rb
index e7ecbbdf2..54391c3de 100755
--- a/lib/puppet/network/handler/resource.rb
+++ b/lib/puppet/network/handler/resource.rb
@@ -29,7 +29,7 @@ class Puppet::Network::Handler
unless local?
begin
case format
- when "yaml":
+ when "yaml"
bucket = YAML::load(Base64.decode64(bucket))
else
raise Puppet::Error, "Unsupported format '%s'" % format
@@ -99,7 +99,7 @@ class Puppet::Network::Handler
unless @local
case format
- when "yaml":
+ when "yaml"
trans = Base64.encode64(YAML::dump(trans))
else
raise XMLRPC::FaultException.new(
@@ -143,7 +143,7 @@ class Puppet::Network::Handler
unless @local
case format
- when "yaml":
+ when "yaml"
begin
bucket = Base64.encode64(YAML::dump(bucket))
rescue => detail
diff --git a/lib/puppet/network/http.rb b/lib/puppet/network/http.rb
index 3b81d38b5..844af909f 100644
--- a/lib/puppet/network/http.rb
+++ b/lib/puppet/network/http.rb
@@ -1,10 +1,10 @@
module Puppet::Network::HTTP
def self.server_class_by_type(kind)
case kind.to_sym
- when :webrick:
+ when :webrick
require 'puppet/network/http/webrick'
return Puppet::Network::HTTP::WEBrick
- when :mongrel:
+ when :mongrel
raise ArgumentError, "Mongrel is not installed on this platform" unless Puppet.features.mongrel?
require 'puppet/network/http/mongrel'
return Puppet::Network::HTTP::Mongrel