Faidon Liambotis has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/403616 )
Change subject: utils: fix Style/GlobalVars cop violations
......................................................................
utils: fix Style/GlobalVars cop violations
Change-Id: I272537bc40fe4a17d23c78c5b4d554bd6b1e75c6
---
M .rubocop_todo.yml
M utils/expanderb.rb
M utils/hiera_lookup
3 files changed, 8 insertions(+), 13 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/16/403616/1
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 292a1b9..9f6df5b 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -8,11 +8,6 @@
Exclude:
- 'modules/labstore/lib/puppet/parser/functions/mount_nfs_volume.rb'
-Style/GlobalVars:
- Exclude:
- - 'utils/expanderb.rb'
- - 'utils/hiera_lookup'
-
Style/HashSyntax:
Enabled: false
diff --git a/utils/expanderb.rb b/utils/expanderb.rb
index cb2882f..8fdfed2 100755
--- a/utils/expanderb.rb
+++ b/utils/expanderb.rb
@@ -15,14 +15,14 @@
require 'English'
# Filename of the ERB template we are going to expand
-$filename = nil
+filename = nil
# Parsing the options
optparse = OptionParser.new do |opts|
opts.banner = "Usage: expanderb.rb -f FILENAME [key=val [key2=val]]"
opts.on('-f', '--filename FILENAME', 'ERB filename to expand') do |f|
- $filename = f
+ filename = f
end
opts.on_tail('-h', '--help', 'Show this message') do
@@ -35,7 +35,7 @@
begin
# -f is mandatory
optparse.parse!
- if $filename.nil?
+ if filename.nil?
puts "You must specify an ERB filename."
puts optparse
exit
@@ -63,7 +63,7 @@
# Parse template
begin
- puts render_erb(File.read($filename), template_values)
+ puts render_erb(File.read(filename), template_values)
rescue
p "Something went wrong, usually because you are missing a variable."
p $ERROR_INFO.to_s
diff --git a/utils/hiera_lookup b/utils/hiera_lookup
index 4d6d172..d6c0d10 100755
--- a/utils/hiera_lookup
+++ b/utils/hiera_lookup
@@ -87,7 +87,7 @@
class << self
alias_method :old_datadir, :datadir
def datadir(backend, scope)
- old_datadir(backend, scope).gsub(%r{^.*(?=/hieradata)}, $DIR)
+ old_datadir(backend, scope).gsub(%r{^.*(?=/hieradata)}, DIR)
end
end
end
@@ -101,12 +101,12 @@
verbose = false
end
-$DIR = ENV['PUPPETDIR'] || File.expand_path('../..', __FILE__)
-$LOAD_PATH << File.join($DIR, 'modules/wmflib/lib')
+DIR = ENV['PUPPETDIR'] || File.expand_path('../..', __FILE__)
+$LOAD_PATH << File.join(DIR, 'modules/wmflib/lib')
scope = determine_scope
-cfg = File.join($DIR,
"modules/puppetmaster/files/#{scope['::realm']}.hiera.yaml")
+cfg = File.join(DIR,
"modules/puppetmaster/files/#{scope['::realm']}.hiera.yaml")
unless File.exist?(cfg)
Kernel.abort("Hiera cfg file not found for realm '#{scope['::realm']}':
#{cfg}")
end
--
To view, visit https://gerrit.wikimedia.org/r/403616
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I272537bc40fe4a17d23c78c5b4d554bd6b1e75c6
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits