Class: Leeloo::PrivateLocalFileSystemKeystore
Instance Attribute Summary collapse
Attributes inherited from Keystore
#name
Instance Method Summary
collapse
Methods inherited from Keystore
#footprint, #init, #sync
Constructor Details
Returns a new instance of PrivateLocalFileSystemKeystore.
72
73
74
75
76
|
# File 'lib/leeloo/keystore.rb', line 72
def initialize name, path
super name
@path = path
FileUtils.mkdir_p "#{@path}/secrets"
end
|
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
70
71
72
|
# File 'lib/leeloo/keystore.rb', line 70
def path
@path
end
|
Instance Method Details
#==(keystore) ⇒ Object
95
96
97
|
# File 'lib/leeloo/keystore.rb', line 95
def == keystore
self.name == keystore.name && self.path == keystore.path
end
|
#find_secrets(path) ⇒ Object
86
87
88
89
90
91
92
93
|
# File 'lib/leeloo/keystore.rb', line 86
def find_secrets path
elements = []
Dir.glob("#{path}/**") do |element|
elements << secret_of(element) unless Dir.exist? element
elements << find_secrets(element) if Dir.exist? element
end
return elements.flatten
end
|
108
109
110
111
|
# File 'lib/leeloo/keystore.rb', line 108
def name
secret = secret_from_name name
{ "footprint" => secret., "keystore" => self.name, "secret" => secret.name }
end
|
#keys ⇒ Object
82
83
84
|
# File 'lib/leeloo/keystore.rb', line 82
def keys
[]
end
|
113
114
115
116
117
118
119
|
# File 'lib/leeloo/keystore.rb', line 113
def
secret = secret_from_name ["secret"]
unless secret. == ["footprint"]
raise "footprint is not valid"
end
secret
end
|
#secret_from_name(name) ⇒ Object
104
105
106
|
# File 'lib/leeloo/keystore.rb', line 104
def secret_from_name name
secret_of "#{path}/secrets/#{name}"
end
|
#secret_of(path) ⇒ Object
99
100
101
102
|
# File 'lib/leeloo/keystore.rb', line 99
def secret_of path
name = path.gsub("#{@path}/secrets/", "")
LocalFileSystemSecret.new path, name
end
|
#secrets ⇒ Object
78
79
80
|
# File 'lib/leeloo/keystore.rb', line 78
def secrets
find_secrets "#{@path}/secrets"
end
|