Skip to content

Commit

Permalink
(Maint) Remove unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Dalén committed May 28, 2013
1 parent aed11e2 commit 53241a9
Show file tree
Hide file tree
Showing 109 changed files with 99 additions and 176 deletions.
2 changes: 1 addition & 1 deletion lib/hiera/backend/puppet_backend.rb
Expand Up @@ -48,7 +48,7 @@ def lookup(key, scope, order_override, resolution_type)

Hiera.debug("Looking up #{key} in Puppet backend")

include_class = Puppet::Parser::Functions.function(:include)
Puppet::Parser::Functions.function(:include)
loaded_classes = scope.catalog.classes

hierarchy(scope, order_override).each do |klass|
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/application/agent.rb
Expand Up @@ -410,7 +410,7 @@ def setup_listen
def setup_host
@host = Puppet::SSL::Host.new
waitforcert = options[:waitforcert] || (Puppet[:onetime] ? 0 : Puppet[:waitforcert])
cert = @host.wait_for_cert(waitforcert) unless options[:fingerprint]
@host.wait_for_cert(waitforcert) unless options[:fingerprint]
end

def setup_agent
Expand Down
2 changes: 0 additions & 2 deletions lib/puppet/application/apply.rb
Expand Up @@ -239,8 +239,6 @@ def setup
exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?

Puppet::Util::Log.newdestination(:console) unless options[:logset]
client = nil
server = nil

Signal.trap(:INT) do
$stderr.puts "Exiting"
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/application/device.rb
Expand Up @@ -195,7 +195,7 @@ def main

require 'puppet/configurer'
configurer = Puppet::Configurer.new
report = configurer.run(:network_device => true, :pluginsync => Puppet[:pluginsync])
configurer.run(:network_device => true, :pluginsync => Puppet[:pluginsync])
rescue => detail
Puppet.log_exception(detail)
ensure
Expand All @@ -210,7 +210,7 @@ def main
def setup_host
@host = Puppet::SSL::Host.new
waitforcert = options[:waitforcert] || (Puppet[:onetime] ? 0 : Puppet[:waitforcert])
cert = @host.wait_for_cert(waitforcert)
@host.wait_for_cert(waitforcert)
end

def setup
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/application/kick.rb
Expand Up @@ -240,7 +240,7 @@ def main

def run_for_host(host)
if options[:ping]
out = %x{ping -c 1 #{host}}
%x{ping -c 1 #{host}}
unless $CHILD_STATUS == 0
$stderr.print "Could not contact #{host}\n"
exit($CHILD_STATUS)
Expand Down
5 changes: 0 additions & 5 deletions lib/puppet/external/nagios/base.rb
Expand Up @@ -271,7 +271,6 @@ def parent
# okay, this sucks
# how do i get my list of ocs?
def to_ldif
base = self.class.ldapbase
str = self.dn + "\n"
ocs = Array.new
if self.class.ocs
Expand Down Expand Up @@ -410,7 +409,6 @@ def type
end

newtype :servicedependency do
auxiliary = true
setparameters :dependent_host_name, :dependent_hostgroup_name,
:dependent_service_description, :host_name, :hostgroup_name,
:service_description, :inherits_parent, :execution_failure_criteria,
Expand All @@ -433,7 +431,6 @@ def type
end

newtype :hostdependency do
auxiliary = true
setparameters :dependent_host_name, :dependent_hostgroup_name, :host_name,
:hostgroup_name, :inherits_parent, :execution_failure_criteria,
:notification_failure_criteria, :dependency_period,
Expand All @@ -454,7 +451,6 @@ def type
end

newtype :hostextinfo do
auxiliary = true
setparameters :host_name, :notes, :notes_url, :icon_image, :icon_image_alt,
:vrml_image, :statusmap_image, "2d_coords".intern, "3d_coords".intern,
:register, :use
Expand All @@ -463,7 +459,6 @@ def type
end

newtype :serviceextinfo do
auxiliary = true

setparameters :host_name, :service_description, :notes, :notes_url,
:action_url, :icon_image, :icon_image_alt,
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/face/ca.rb
Expand Up @@ -204,7 +204,7 @@

when_invoked do |host, options|
raise "Not a CA" unless Puppet::SSL::CertificateAuthority.ca?
unless ca = Puppet::SSL::CertificateAuthority.instance
unless Puppet::SSL::CertificateAuthority.instance
raise "Unable to fetch the CA"
end
Puppet::SSL::Host.ca_location = :only
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/face/config.rb
Expand Up @@ -36,7 +36,7 @@
EOT

when_invoked do |*args|
options = args.pop
args.pop

args = [ "all" ] if args.empty?

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/face/help.rb
Expand Up @@ -140,7 +140,7 @@ def all_application_summaries()
begin
face = Puppet::Face[appname, :current]
result << [appname, face.summary]
rescue Puppet::Error => detail
rescue Puppet::Error
result << [ "! #{appname}", "! Subcommand unavailable due to error. Check error logs." ]
end
else
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/feature/rails.rb
Expand Up @@ -23,7 +23,7 @@

require 'active_record'
require 'active_record/version'
rescue LoadError => detail
rescue LoadError
if FileTest.exists?("/usr/share/rails")
count = 0
Dir.entries("/usr/share/rails").each do |dir|
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/file_bucket/dipper.rb
Expand Up @@ -77,7 +77,6 @@ def restore(file,sum)

if restore
if newcontents = getfile(sum)
tmp = ""
newsum = Digest::MD5.hexdigest(newcontents)
changed = nil
if FileTest.exists?(file) and ! FileTest.writable?(file)
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/file_serving/base.rb
Expand Up @@ -15,7 +15,7 @@ class Puppet::FileServing::Base
def exist?
stat
return true
rescue => detail
rescue
return false
end

Expand Down
6 changes: 2 additions & 4 deletions lib/puppet/file_serving/configuration/parser.rb
Expand Up @@ -62,8 +62,7 @@ def changed?

# Allow a given pattern access to a mount.
def allow(mount, value)
# LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
x = value.split(/\s*,\s*/).each { |val|
value.split(/\s*,\s*/).each { |val|
begin
mount.info "allowing #{val} access"
mount.allow(val)
Expand All @@ -75,8 +74,7 @@ def allow(mount, value)

# Deny a given pattern access to a mount.
def deny(mount, value)
# LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
x = value.split(/\s*,\s*/).each { |val|
value.split(/\s*,\s*/).each { |val|
begin
mount.info "denying #{val} access"
mount.deny(val)
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/forge/errors.rb
Expand Up @@ -30,7 +30,7 @@ def initialize(options)
#
# @return [String] the multiline version of the error message
def multiline
message = <<-EOS.chomp
<<-EOS.chomp
Could not connect via HTTPS to #{@uri}
Unable to verify the SSL certificate
The certificate may not be signed by a valid CA
Expand All @@ -57,7 +57,7 @@ def initialize(options)
#
# @return [String] the multiline version of the error message
def multiline
message = <<-EOS.chomp
<<-EOS.chomp
Could not connect to #{@uri}
There was a network communications problem
The error we caught said '#{@detail}'
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/indirector/facts/facter.rb
Expand Up @@ -19,7 +19,7 @@ def self.load_fact_plugins
end
end.flatten
dirs = module_fact_dirs + Puppet[:factpath].split(File::PATH_SEPARATOR)
x = dirs.uniq.each do |dir|
dirs.uniq.each do |dir|
load_facts_in_dir(dir)
end
end
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/indirector/facts/inventory_active_record.rb
Expand Up @@ -46,7 +46,6 @@ def save(request)
def search(request)
return [] unless request.options
matching_nodes = []
fact_names = []
fact_filters = Hash.new {|h,k| h[k] = []}
meta_filters = Hash.new {|h,k| h[k] = []}
request.options.each do |key,value|
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/indirector/file_bucket_file/file.rb
Expand Up @@ -22,7 +22,6 @@ def find( request )
return nil unless path_match(dir_path, files_original_path)

if request.options[:diff_with]
hash_protocol = sumtype(checksum)
file2_path = path_for(request.options[:bucket_path], request.options[:diff_with], 'contents')
raise "could not find diff_with #{request.options[:diff_with]}" unless ::File.exists?(file2_path)
return `diff #{file_path.inspect} #{file2_path.inspect}`
Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/indirector/indirection.rb
Expand Up @@ -88,7 +88,7 @@ def doc
text += scrub(@doc) + "\n\n" if @doc

text << "* **Indirected Class**: `#{@indirected_class}`\n";
if s = terminus_setting
if terminus_setting
text << "* **Terminus Setting**: #{terminus_setting}\n"
end

Expand Down Expand Up @@ -247,7 +247,7 @@ def destroy(key, options={})

result = terminus.destroy(request)

if cache? and cached = cache.find(request(:find, key, nil, options))
if cache? and cache.find(request(:find, key, nil, options))
# Reuse the existing request, since it's equivalent.
cache.destroy(request)
end
Expand Down
4 changes: 1 addition & 3 deletions lib/puppet/indirector/node/ldap.rb
Expand Up @@ -9,8 +9,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap

# The attributes that Puppet class information is stored in.
def class_attributes
# LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
x = Puppet[:ldapclassattrs].split(/\s*,\s*/)
Puppet[:ldapclassattrs].split(/\s*,\s*/)
end

# Separate this out so it's relatively atomic. It's tempting to call
Expand Down Expand Up @@ -198,7 +197,6 @@ def info2node(name, info)
end

def merge_parent(info)
parent_info = nil
parent = info[:parent]

# Preload the parent array with the node name.
Expand Down
3 changes: 1 addition & 2 deletions lib/puppet/indirector/report/processor.rb
Expand Up @@ -43,8 +43,7 @@ def process(report)

# Handle the parsing of the reports attribute.
def reports
# LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
x = Puppet[:reports].gsub(/(^\s+)|(\s+$)/, '').split(/\s*,\s*/)
Puppet[:reports].gsub(/(^\s+)|(\s+$)/, '').split(/\s*,\s*/)
end

def processors(&blk)
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/interface.rb
Expand Up @@ -101,7 +101,7 @@ def face?(name, version)
def [](name, version)
unless face = Puppet::Interface::FaceCollection[name, version]
# REVISIT (#18042) no sense in rechecking if version == :current -- josh
if current = Puppet::Interface::FaceCollection[name, :current]
if Puppet::Interface::FaceCollection[name, :current]
raise Puppet::Error, "Could not find version #{version} of #{name}"
else
raise Puppet::Error, "Could not find Puppet Face #{name.to_s}"
Expand Down
3 changes: 1 addition & 2 deletions lib/puppet/interface/documentation.rb
Expand Up @@ -79,7 +79,7 @@ module TinyDocs

# @api private
def build_synopsis(face, action = nil, arguments = nil)
output = PrettyPrint.format do |s|
PrettyPrint.format do |s|
s.text("puppet #{face}")
s.text(" #{action}") unless action.nil?
s.text(" ")
Expand All @@ -105,7 +105,6 @@ def build_synopsis(face, action = nil, arguments = nil)
display_global_options.sort.each do |option|
wrap = %w{ [ ] }
s.group(0, *wrap) do
desc = Puppet.settings.setting(option).desc
type = Puppet.settings.setting(option).default
type ||= Puppet.settings.setting(option).type.to_s.upcase
s.text "--#{option} #{type}"
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/interface/option.rb
Expand Up @@ -84,7 +84,7 @@ def optparse_to_optionname(declaration)
unless found = declaration.match(/^-+(?:\[no-\])?([^ =]+)/) then
raise ArgumentError, "Can't find a name in the declaration #{declaration.inspect}"
end
name = found.captures.first
found.captures.first
end

# @api private
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/metatype/manager.rb
Expand Up @@ -131,7 +131,7 @@ def newtype(name, options = {}, &block)
def rmtype(name)
# Then create the class.

klass = rmclass(name, :hash => @types)
rmclass(name, :hash => @types)

singleton_class.send(:remove_method, "new#{name}") if respond_to?("new#{name}")
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/module.rb
Expand Up @@ -225,7 +225,7 @@ def unmet_dependencies

dep_mod = begin
environment.module_by_forge_name(forge_name)
rescue => e
rescue
nil
end

Expand Down
1 change: 0 additions & 1 deletion lib/puppet/network/formats.rb
Expand Up @@ -149,7 +149,6 @@ def render(datum)
if datum.is_a? Hash and datum.keys.all? { |x| x.is_a? String or x.is_a? Numeric }
output = ''
column_a = datum.empty? ? 2 : datum.map{ |k,v| k.to_s.length }.max + 2
column_b = 79 - column_a
datum.sort_by { |k,v| k.to_s } .each do |key, value|
output << key.to_s.ljust(column_a)
output << json.render(value).
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/network/http/compression.rb
Expand Up @@ -69,7 +69,7 @@ def uncompress(chunk)
out = @uncompressor.inflate(chunk)
@first = false
return out
rescue Zlib::DataError => z
rescue Zlib::DataError
# it can happen that we receive a raw deflate stream
# which might make our inflate throw a data error.
# in this case, we try with a verbatim (no header)
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/node/environment.rb
Expand Up @@ -140,7 +140,7 @@ def module_by_forge_name(forge_name)
module_references.collect do |reference|
begin
Puppet::Module.new(reference[:name], reference[:path], self)
rescue Puppet::Module::Error => e
rescue Puppet::Module::Error
nil
end
end.compact
Expand Down
3 changes: 0 additions & 3 deletions lib/puppet/parser/ast/casestatement.rb
Expand Up @@ -15,9 +15,6 @@ def evaluate(scope)

value = @test.safeevaluate(scope)

retvalue = nil
found = false

# Iterate across the options looking for a match.
default = nil
@options.each do |option|
Expand Down
2 changes: 0 additions & 2 deletions lib/puppet/parser/ast/resource_override.rb
Expand Up @@ -23,8 +23,6 @@ def evaluate(scope)
# Get our object reference.
resource = @object.safeevaluate(scope)

hash = {}

# Evaluate all of the specified params.
params = @parameters.collect { |param|
param.safeevaluate(scope)
Expand Down
2 changes: 0 additions & 2 deletions lib/puppet/parser/functions/each.rb
Expand Up @@ -41,7 +41,6 @@ def foreach_Array(o, scope, pblock)
end
enumerator = o.each
index = 0
result = nil
if serving_size == 1
(o.size).times do
pblock.call(scope, enumerator.next)
Expand All @@ -67,7 +66,6 @@ def foreach_Hash(o, scope, pblock)
raise ArgumentError, "Block must define at most two parameters (for hash entry key and value)."
end
enumerator = o.each_pair
result = nil
if serving_size == 1
(o.size).times do
pblock.call(scope, enumerator.next)
Expand Down
2 changes: 0 additions & 2 deletions lib/puppet/parser/functions/foreach.rb
Expand Up @@ -41,7 +41,6 @@ def foreach_Array(o, scope, pblock)
end
enumerator = o.each
index = 0
result = nil
if serving_size == 1
(o.size).times do
pblock.call(scope, enumerator.next)
Expand All @@ -67,7 +66,6 @@ def foreach_Hash(o, scope, pblock)
raise ArgumentError, "Block must define at most two parameters (for hash entry key and value)."
end
enumerator = o.each_pair
result = nil
if serving_size == 1
(o.size).times do
pblock.call(scope, enumerator.next)
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/parser/lexer.rb
Expand Up @@ -460,7 +460,6 @@ def scan
skip

until token_queue.empty? and @scanner.eos? do
yielded = false
matched_token, value = find_token

# error out if we didn't match anything at all
Expand Down

0 comments on commit 53241a9

Please sign in to comment.