Skip to content

Commit

Permalink
cleaning in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
mose committed Sep 2, 2015
1 parent fb19e85 commit d418956
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 26 deletions.
10 changes: 0 additions & 10 deletions lib/hieracles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,17 @@ def self.usage
Available commands:
info provides the farm, datacenter, country associated to the given fqdn
files list all files containing params affecting this fqdn (in more than commons)
file -- alias for files
paths list all file paths for files with params
path -- alias to paths
modules list modules included in the farm where the node is
classes -- alias for modules
params list params for the node matching the fqdn
An extra filter string can be added to limit the list
use ruby regexp without the enclosing slashes
eg. hc <fqdn> params postfix.*version
eg. hc <fqdn> params '^postfix'
eg. hc <fqdn> params 'version$'
param -- alias for params
allparams same as params but including the common.yaml params (huge)
Also accepts a search string
all -- alias for allparams
END
end

Expand Down
4 changes: 0 additions & 4 deletions lib/hieracles/dispatch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def files(*args)
def paths(*args)
puts @node.paths.join(',')
end
alias path paths

def params(args)
filter = args[0]
Expand All @@ -41,13 +40,11 @@ def params(args)
end
puts output
end
alias param params
def allparams(args)
@node.add_common
params(args)
end
alias all allparams
def modules(args)
if Config.format == 'raw'
Expand All @@ -66,7 +63,6 @@ def modules(args)
end
end
end
alias classes modules
protected
Expand Down
6 changes: 0 additions & 6 deletions lib/hieracles/formats/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,11 @@ def params(args)
end
end
end
alias param params


def allparams(args)
@node.add_common
params(args)
end
alias all allparams


def modules(args)
if Config.format == 'raw'
Expand All @@ -70,7 +66,6 @@ def modules(args)
end
end
end
alias classes modules

def show_head(colors)
@node.files.each_with_index do |f,i|
Expand All @@ -80,7 +75,6 @@ def show_head(colors)
puts
end


end

end
Expand Down
12 changes: 6 additions & 6 deletions lib/hieracles/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def paths
end

def params
@_populated_params ||= populate_params
@_populated_params ||= populate_params(@files)
end

def modules
@_populated_modules ||= populate_modules
@_populated_modules ||= populate_modules(@farm)
end

def add_common
Expand Down Expand Up @@ -91,9 +91,9 @@ def modulepath(path)
File.join("modules", path)
end

def populate_params
def populate_params(files)
params = {}
@files.each do |f|
files.each do |f|
data = YAML.load_file(f)
s = to_shallow_hash(data)
s.each do |k,v|
Expand All @@ -104,8 +104,8 @@ def populate_params
params.sort
end

def populate_modules
classfile = classpath(@farm)
def populate_modules(farm)
classfile = classpath(farm)
if File.exist?(classfile)
modules = {}
f = File.open(classfile, "r")
Expand Down

0 comments on commit d418956

Please sign in to comment.