Revision 0c7641a0
Added by Thomas McKay over 8 years ago
lib/hammer_cli_csv/puppet_facts.rb | ||
---|---|---|
42 | 42 |
module HammerCLICsv |
43 | 43 |
class PuppetFactsCommand < BaseCommand |
44 | 44 |
|
45 |
NAME = 'Name' |
|
46 |
COUNT = 'Count' |
|
47 |
|
|
48 | 45 |
def execute |
49 | 46 |
super |
50 | 47 |
csv_export? ? export : import |
... | ... | |
88 | 85 |
return |
89 | 86 |
end |
90 | 87 |
|
91 |
puts line |
|
92 | 88 |
line[COUNT].to_i.times do |number| |
93 | 89 |
name = namify(line[NAME], number) |
94 | 90 |
print "Updating puppetfacts '#{name}'..." if verbose? |
... | ... | |
99 | 95 |
# Namify the values if the host name was namified |
100 | 96 |
if name != line[NAME] |
101 | 97 |
facts.each do |fact, value| |
102 |
facts[fact] = namify(value, number) |
|
98 |
facts[fact] = namify(value, number) unless value.nil? || value.empty?
|
|
103 | 99 |
end |
104 | 100 |
end |
105 | 101 |
|
Also available in: Unified diff
pfacts - facts working