From a7d4da81df78fa0ac068d056c93f28e35fc1f1b9 Mon Sep 17 00:00:00 2001 From: Tomas Doran Date: Wed, 26 Jun 2013 13:54:44 +0100 Subject: [PATCH 1/2] Add {} and " to unsafe characters list --- lib/puppet/parser/functions/uriescape.rb | 2 +- spec/unit/puppet/parser/functions/uriescape_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/parser/functions/uriescape.rb b/lib/puppet/parser/functions/uriescape.rb index 67b93a64d..78f4cf5e9 100644 --- a/lib/puppet/parser/functions/uriescape.rb +++ b/lib/puppet/parser/functions/uriescape.rb @@ -15,7 +15,7 @@ module Puppet::Parser::Functions value = arguments[0] klass = value.class - unsafe = ":/?#[]@!$&'()*+,;= " + unsafe = ":/?#[]@!$&'()*+,;= {}\"" unless [Array, String].include?(klass) raise(Puppet::ParseError, 'uriescape(): Requires either ' + diff --git a/spec/unit/puppet/parser/functions/uriescape_spec.rb b/spec/unit/puppet/parser/functions/uriescape_spec.rb index 371de4687..880540836 100644 --- a/spec/unit/puppet/parser/functions/uriescape_spec.rb +++ b/spec/unit/puppet/parser/functions/uriescape_spec.rb @@ -13,8 +13,8 @@ end it "should uriescape a string" do - result = scope.function_uriescape([":/?#[]@!$&'()*+,;= "]) - result.should(eq('%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%20')) + result = scope.function_uriescape([":/?#[]@!$&'()*+,;= \"{}"]) + result.should(eq('%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%20%22%7B%7D')) end it "should do nothing if a string is already safe" do From 251fb074c0605d275568ab3e9d833c24c4c042ee Mon Sep 17 00:00:00 2001 From: Chris Boot Date: Thu, 27 Jun 2013 17:51:36 +0100 Subject: [PATCH 2/2] ensure_resource: fix documentation typo --- README.markdown | 2 +- lib/puppet/parser/functions/ensure_resource.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 0e40f51a8..2a1ddfdd5 100644 --- a/README.markdown +++ b/README.markdown @@ -258,7 +258,7 @@ resource. This example only creates the resource if it does not already exist: - ensure_resource('user, 'dan', {'ensure' => 'present' }) + ensure_resource('user', 'dan', {'ensure' => 'present' }) If the resource already exists but does not match the specified parameters, this function will attempt to recreate the resource leading to a duplicate diff --git a/lib/puppet/parser/functions/ensure_resource.rb b/lib/puppet/parser/functions/ensure_resource.rb index a9a17338e..05e5593fc 100644 --- a/lib/puppet/parser/functions/ensure_resource.rb +++ b/lib/puppet/parser/functions/ensure_resource.rb @@ -13,7 +13,7 @@ This example only creates the resource if it does not already exist: - ensure_resource('user, 'dan', {'ensure' => 'present' }) + ensure_resource('user', 'dan', {'ensure' => 'present' }) If the resource already exists but does not match the specified parameters, this function will attempt to recreate the resource leading to a duplicate