Skip to content

Commit c7100ef

Browse files
authored
Merge pull request #858 from tphoney/MODULES-6139
MODULES-6139 Revert to old ruby 1.X style of hash
2 parents e5dff2f + 5956bff commit c7100ef

File tree

281 files changed

+616
-614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+616
-614
lines changed

.rubocop.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ RSpec/BeforeAfterAll:
2525
RSpec/HookArgument:
2626
Description: Prefer explicit :each argument, matching existing module's style
2727
EnforcedStyle: each
28+
Style/HashSyntax:
29+
EnforcedStyle: hash_rockets
2830
Style/BlockDelimiters:
2931
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
3032
be consistent then.
@@ -97,4 +99,4 @@ Style/IfUnlessModifier:
9799
Style/SymbolProc:
98100
Enabled: false
99101
RSpec/NamedSubject:
100-
Enabled: false
102+
Enabled: false

lib/facter/facter_dot_d.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def cache_save!
119119
def cache_store(file, data)
120120
load_cache
121121

122-
@cache[file] = { data: data, stored: Time.now.to_i }
122+
@cache[file] = { :data => data, :stored => Time.now.to_i }
123123
rescue # rubocop:disable Lint/HandleExceptions - Is meant to be suppressed
124124
end
125125

lib/facter/package_provider.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
Facter.add(:package_provider) do
1414
setcode do
1515
if defined? Gem && Gem::Version.new(Facter.value(:puppetversion).split(' ')[0]) >= Gem::Version.new('3.6')
16-
Puppet::Type.type(:package).newpackage(name: 'dummy', allow_virtual: 'true')[:provider].to_s
16+
Puppet::Type.type(:package).newpackage(:name => 'dummy', :allow_virtual => 'true')[:provider].to_s
1717
else
18-
Puppet::Type.type(:package).newpackage(name: 'dummy')[:provider].to_s
18+
Puppet::Type.type(:package).newpackage(:name => 'dummy')[:provider].to_s
1919
end
2020
end
2121
end

lib/facter/pe_version.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
end
3232

3333
Facter.add('pe_major_version') do
34-
confine is_pe: true
34+
confine :is_pe => true
3535
setcode do
3636
pe_version = Facter.value(:pe_version)
3737
if pe_version
@@ -41,7 +41,7 @@
4141
end
4242

4343
Facter.add('pe_minor_version') do
44-
confine is_pe: true
44+
confine :is_pe => true
4545
setcode do
4646
pe_version = Facter.value(:pe_version)
4747
if pe_version
@@ -51,7 +51,7 @@
5151
end
5252

5353
Facter.add('pe_patch_version') do
54-
confine is_pe: true
54+
confine :is_pe => true
5555
setcode do
5656
pe_version = Facter.value(:pe_version)
5757
if pe_version

lib/facter/root_home.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def returnt_root_home
1818
end
1919

2020
Facter.add(:root_home) do
21-
confine kernel: :darwin
21+
confine :kernel => :darwin
2222
setcode do
2323
str = Facter::Util::Resolution.exec('dscacheutil -q user -a name root')
2424
hash = {}
@@ -31,7 +31,7 @@ def returnt_root_home
3131
end
3232

3333
Facter.add(:root_home) do
34-
confine kernel: :aix
34+
confine :kernel => :aix
3535
root_home = nil
3636
setcode do
3737
str = Facter::Util::Resolution.exec('lsuser -c -a home root')

lib/facter/service_provider.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
Facter.add(:service_provider) do
1414
setcode do
15-
Puppet::Type.type(:service).newservice(name: 'dummy')[:provider].to_s
15+
Puppet::Type.type(:service).newservice(:name => 'dummy')[:provider].to_s
1616
end
1717
end

lib/puppet/parser/functions/abs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# abs.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:abs, type: :rvalue, doc: <<-EOS
5+
newfunction(:abs, :type => :rvalue, :doc => <<-EOS
66
Returns the absolute value of a number, for example -34.56 becomes
77
34.56. Takes a single integer and float value as an argument.
88
EOS

lib/puppet/parser/functions/any2array.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# any2array.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:any2array, type: :rvalue, doc: <<-EOS
5+
newfunction(:any2array, :type => :rvalue, :doc => <<-EOS
66
This converts any object to an array containing that object. Empty argument
77
lists are converted to an empty array. Arrays are left untouched. Hashes are
88
converted to arrays of alternating keys and values.

lib/puppet/parser/functions/any2bool.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# any2bool.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:any2bool, type: :rvalue, doc: <<-EOS
5+
newfunction(:any2bool, :type => :rvalue, :doc => <<-EOS
66
This converts 'anything' to a boolean. In practise it does the following:
77
88
* Strings such as Y,y,1,T,t,TRUE,yes,'true' will return true

lib/puppet/parser/functions/assert_private.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# assert_private.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:assert_private, doc: <<-'EOS'
5+
newfunction(:assert_private, :doc => <<-'EOS'
66
Sets the current class or definition as private.
77
Calling the class or definition from outside the current module will fail.
88
EOS

lib/puppet/parser/functions/base64.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
22
module Puppet::Parser::Functions
3-
newfunction(:base64, type: :rvalue, doc: <<-'ENDHEREDOC') do |args|
3+
newfunction(:base64, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
44
Base64 encode or decode a string based on the command and the string submitted
55
66
Usage:

lib/puppet/parser/functions/basename.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# basename.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:basename, type: :rvalue, doc: <<-EOS
5+
newfunction(:basename, :type => :rvalue, :doc => <<-EOS
66
Strips directory (and optional suffix) from a filename
77
EOS
88
) do |arguments|

lib/puppet/parser/functions/bool2num.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# bool2num.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:bool2num, type: :rvalue, doc: <<-EOS
5+
newfunction(:bool2num, :type => :rvalue, :doc => <<-EOS
66
Converts a boolean to a number. Converts the values:
77
false, f, 0, n, and no to 0
88
true, t, 1, y, and yes to 1

lib/puppet/parser/functions/bool2str.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# bool2str.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:bool2str, type: :rvalue, doc: <<-EOS
5+
newfunction(:bool2str, :type => :rvalue, :doc => <<-EOS
66
Converts a boolean to a string using optionally supplied arguments. The
77
optional second and third arguments represent what true and false will be
88
converted to respectively. If only one argument is given, it will be

lib/puppet/parser/functions/camelcase.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
44
#
55
module Puppet::Parser::Functions
6-
newfunction(:camelcase, type: :rvalue, doc: <<-EOS
6+
newfunction(:camelcase, :type => :rvalue, :doc => <<-EOS
77
Converts the case of a string or all strings in an array to camel case.
88
EOS
99
) do |arguments|

lib/puppet/parser/functions/capitalize.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
44
#
55
module Puppet::Parser::Functions
6-
newfunction(:capitalize, type: :rvalue, doc: <<-EOS
6+
newfunction(:capitalize, :type => :rvalue, :doc => <<-EOS
77
Capitalizes the first letter of a string or array of strings.
88
Requires either a single string or an array as an input.
99
EOS

lib/puppet/parser/functions/ceiling.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ceiling.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:ceiling, type: :rvalue, doc: <<-EOS
5+
newfunction(:ceiling, :type => :rvalue, :doc => <<-EOS
66
Returns the smallest integer greater or equal to the argument.
77
Takes a single numeric value as an argument.
88
EOS

lib/puppet/parser/functions/chomp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# chomp.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:chomp, type: :rvalue, doc: <<-'EOS'
5+
newfunction(:chomp, :type => :rvalue, :doc => <<-'EOS'
66
Removes the record separator from the end of a string or an array of
77
strings, for example `hello\n` becomes `hello`.
88
Requires a single string or array as an input.

lib/puppet/parser/functions/chop.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# chop.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:chop, type: :rvalue, doc: <<-'EOS'
5+
newfunction(:chop, :type => :rvalue, :doc => <<-'EOS'
66
Returns a new string with the last character removed. If the string ends
77
with `\r\n`, both characters are removed. Applying chop to an empty
88
string returns an empty string. If you wish to merely remove record

lib/puppet/parser/functions/clamp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# clamp.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:clamp, type: :rvalue, arity: -2, doc: <<-EOS
5+
newfunction(:clamp, :type => :rvalue, :arity => -2, :doc => <<-EOS
66
Clamps value to a range.
77
EOS
88
) do |args|

lib/puppet/parser/functions/concat.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# concat.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:concat, type: :rvalue, doc: <<-EOS
5+
newfunction(:concat, :type => :rvalue, :doc => <<-EOS
66
Appends the contents of multiple arrays into array 1.
77
88
*Example:*

lib/puppet/parser/functions/convert_base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# convert_base.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:convert_base, type: :rvalue, arity: 2, doc: <<-'ENDHEREDOC') do |args|
5+
newfunction(:convert_base, :type => :rvalue, :arity => 2, :doc => <<-'ENDHEREDOC') do |args|
66
Converts a given integer or base 10 string representing an integer to a specified base, as a string.
77
88
Usage:

lib/puppet/parser/functions/count.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# count.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:count, type: :rvalue, arity: -2, doc: <<-EOS
5+
newfunction(:count, :type => :rvalue, :arity => -2, :doc => <<-EOS
66
Takes an array as first argument and an optional second argument.
77
Count the number of elements in array that matches second argument.
88
If called with only an array it counts the number of elements that are not nil/undef.

lib/puppet/parser/functions/deep_merge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# deep_merge.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:deep_merge, type: :rvalue, doc: <<-'ENDHEREDOC') do |args|
5+
newfunction(:deep_merge, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
66
Recursively merges two or more hashes together and returns the resulting hash.
77
88
For example:

lib/puppet/parser/functions/defined_with_params.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
require 'puppet/parser/functions'
33

44
Puppet::Parser::Functions.newfunction(:defined_with_params,
5-
type: :rvalue,
6-
doc: <<-'ENDOFDOC'
5+
:type => :rvalue,
6+
:doc => <<-'ENDOFDOC'
77
Takes a resource reference and an optional hash of attributes.
88
99
Returns true if a resource with the specified attributes has already been added

lib/puppet/parser/functions/delete.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# delete.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:delete, type: :rvalue, doc: <<-EOS
5+
newfunction(:delete, :type => :rvalue, :doc => <<-EOS
66
Deletes all instances of a given element from an array, substring from a
77
string, or key from a hash.
88

lib/puppet/parser/functions/delete_at.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# delete_at.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:delete_at, type: :rvalue, doc: <<-EOS
5+
newfunction(:delete_at, :type => :rvalue, :doc => <<-EOS
66
Deletes a determined indexed value from an array.
77
88
*Examples:*

lib/puppet/parser/functions/delete_regex.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
44
#
55
module Puppet::Parser::Functions
6-
newfunction(:delete_regex, type: :rvalue, doc: <<-EOS
6+
newfunction(:delete_regex, :type => :rvalue, :doc => <<-EOS
77
deletes all instances of a given element that match a regular expression
88
from an array or key from a hash. Multiple regular expressions are assumed
99
to be matched as an OR.

lib/puppet/parser/functions/delete_undef_values.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# delete_undef_values.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:delete_undef_values, type: :rvalue, doc: <<-EOS
5+
newfunction(:delete_undef_values, :type => :rvalue, :doc => <<-EOS
66
Returns a copy of input hash or array with all undefs deleted.
77
88
*Examples:*

lib/puppet/parser/functions/delete_values.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# delete_values.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:delete_values, type: :rvalue, doc: <<-EOS
5+
newfunction(:delete_values, :type => :rvalue, :doc => <<-EOS
66
Deletes all instances of a given value from a hash.
77
88
*Examples:*

lib/puppet/parser/functions/deprecation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# deprecation.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:deprecation, doc: <<-EOS
5+
newfunction(:deprecation, :doc => <<-EOS
66
Function to print deprecation warnings (this is the 3.X version of it), The uniqueness key - can appear once. The msg is the message text including any positional information that is formatted by the user/caller of the method.).
77
EOS
88
) do |arguments|

lib/puppet/parser/functions/difference.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# difference.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:difference, type: :rvalue, doc: <<-EOS
5+
newfunction(:difference, :type => :rvalue, :doc => <<-EOS
66
This function returns the difference between two arrays.
77
The returned array is a copy of the original array, removing any items that
88
also appear in the second array.

lib/puppet/parser/functions/dig.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# dig.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:dig, type: :rvalue, doc: <<-EOS
5+
newfunction(:dig, :type => :rvalue, :doc => <<-EOS
66
DEPRECATED: This function has been replaced in Puppet 4.5.0, please use dig44() for backwards compatibility or use the new version.
77
EOS
88
) do |arguments|

lib/puppet/parser/functions/dig44.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
module Puppet::Parser::Functions
55
newfunction(
66
:dig44,
7-
type: :rvalue,
8-
arity: -2,
9-
doc: <<-eos
7+
:type => :rvalue,
8+
:arity => -2,
9+
:doc => <<-eos
1010
DEPRECATED: This function has been replaced in puppet 4.5.0.
1111
1212
Looks up into a complex structure of arrays and hashes and returns a value

lib/puppet/parser/functions/dirname.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# dirname.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:dirname, type: :rvalue, doc: <<-EOS
5+
newfunction(:dirname, :type => :rvalue, :doc => <<-EOS
66
Returns the dirname of a path.
77
EOS
88
) do |arguments|

lib/puppet/parser/functions/dos2unix.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Custom Puppet function to convert dos to unix format
22
module Puppet::Parser::Functions
3-
newfunction(:dos2unix, type: :rvalue, arity: 1, doc: <<-EOS
3+
newfunction(:dos2unix, :type => :rvalue, :arity => 1, :doc => <<-EOS
44
Returns the Unix version of the given string.
55
Takes a single string argument.
66
EOS

lib/puppet/parser/functions/downcase.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
44
#
55
module Puppet::Parser::Functions
6-
newfunction(:downcase, type: :rvalue, doc: <<-EOS
6+
newfunction(:downcase, :type => :rvalue, :doc => <<-EOS
77
Converts the case of a string or all strings in an array to lower case.
88
EOS
99
) do |arguments|

lib/puppet/parser/functions/empty.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# empty.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:empty, type: :rvalue, doc: <<-EOS
5+
newfunction(:empty, :type => :rvalue, :doc => <<-EOS
66
Returns true if the variable is empty.
77
EOS
88
) do |arguments|

lib/puppet/parser/functions/enclose_ipv6.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# enclose_ipv6.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:enclose_ipv6, type: :rvalue, doc: <<-EOS
5+
newfunction(:enclose_ipv6, :type => :rvalue, :doc => <<-EOS
66
Takes an array of ip addresses and encloses the ipv6 addresses with square brackets.
77
EOS
88
) do |arguments|

lib/puppet/parser/functions/ensure_packages.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ensure_packages.rb
33
#
44
module Puppet::Parser::Functions
5-
newfunction(:ensure_packages, type: :statement, doc: <<-EOS
5+
newfunction(:ensure_packages, :type => :statement, :doc => <<-EOS
66
Takes a list of packages and only installs them if they don't already exist.
77
It optionally takes a hash as a second parameter that will be passed as the
88
third argument to the ensure_resource() function.

0 commit comments

Comments
 (0)