diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-17 21:41:50 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-17 21:41:50 +0000 |
| commit | 46252b5bb858a1f2b87cc8646f3a59f935c58061 (patch) | |
| tree | 47d016a74967ae7fac18b711dcf7c8a998730d9d /lib/puppet/parser | |
| parent | 6084e1a0efa2165e5cb10fff9ef0b06c1560f9c0 (diff) | |
| download | puppet-46252b5bb858a1f2b87cc8646f3a59f935c58061.tar.gz puppet-46252b5bb858a1f2b87cc8646f3a59f935c58061.tar.xz puppet-46252b5bb858a1f2b87cc8646f3a59f935c58061.zip | |
All rails and language tests now pass again. All of the rails tests should now be in the rails/ directory, and I have modified resource translation so that it always converts single-member arrays to singe values, which means the rails collection does not need to worry about it.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2597 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser')
| -rw-r--r-- | lib/puppet/parser/resource.rb | 11 | ||||
| -rw-r--r-- | lib/puppet/parser/resource/param.rb | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index 25c9ab707..0722f388c 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -356,7 +356,16 @@ class Puppet::Parser::Resource av } end - obj[p.to_s] = v + + # If the value is an array with only one value, then + # convert it to a single value. This is largely so that + # the database interaction doesn't have to worry about + # whether it returns an array or a string. + obj[p.to_s] = if v.is_a?(Array) and v.length == 1 + v[0] + else + v + end end obj.file = self.file diff --git a/lib/puppet/parser/resource/param.rb b/lib/puppet/parser/resource/param.rb index c719a7fd8..4d95db46a 100644 --- a/lib/puppet/parser/resource/param.rb +++ b/lib/puppet/parser/resource/param.rb @@ -22,7 +22,7 @@ class Puppet::Parser::Resource::Param # Store a new parameter in a Rails db. def to_rails(db_resource) values = value.is_a?(Array) ? value : [value] - values.map! { |v| v.to_s } + values = values.map { |v| v.to_s } param_name = Puppet::Rails::ParamName.find_or_create_by_name(self.name.to_s) line_number = line_to_i() |
