def self.find_recipients
recipient_option = self.option :recipients
recipients = if !recipient_option.nil?
debug("Using --recipients option")
recipient_option.split(",")
else
recipient_file_option = self.option :recipients_file
recipient_file = if !recipient_file_option.nil?
debug("Using --recipients-file option")
Pathname.new(recipient_file_option)
else
debug("Searching for any hiera-eyaml-gpg.recipients files in path")
filename = case Eyaml::Options[:source]
when :file
Eyaml::Options[:file]
when :eyaml
Eyaml::Options[:eyaml]
else
nil
end
if filename.nil?
nil
else
path = Pathname.new(filename).realpath.dirname
selected_file = nil
path.descend{|path| path
potential_file = path.join('hiera-eyaml-gpg.recipients')
selected_file = potential_file if potential_file.exist?
}
debug("Using file at #{selected_file}")
selected_file
end
end
unless recipient_file.nil?
recipient_file.readlines.map{ |line|
line.strip unless line.start_with? '#'
}.compact
else
[]
end
end
end