Class: ICSP::Commands::Certificate::Install
Instance Attribute Summary
Attributes inherited from BaseCommand
#arguments, #config, #options, #prompt
Instance Method Summary
collapse
Methods inherited from BaseCommand
#initialize
Instance Method Details
#available_stores ⇒ Object
42
43
44
|
# File 'lib/commands/certificate/install.rb', line 42
def available_stores
%w[uMy root ca]
end
|
#certmgr ⇒ Object
7
8
9
|
# File 'lib/commands/certificate/install.rb', line 7
def certmgr
@certmgr ||= @config.certmgr
end
|
#execute ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/commands/certificate/install.rb', line 11
def execute
unless options[:file]
install_from_container
return
end
install_from_file
end
|
#install_from_container ⇒ Object
20
21
22
23
24
25
|
# File 'lib/commands/certificate/install.rb', line 20
def install_from_container
result = ::ICSP::Shell.new("#{certmgr} -inst -cont '#{selected_container}'", convert_to_utf8: false).execute
exit(result.exit_code) unless result.ok
puts result
end
|
#install_from_file ⇒ Object
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/commands/certificate/install.rb', line 27
def install_from_file
store = prompt.select('Select store:', available_stores)
not_crl = prompt.no?('Is it CRL?')
result = ::ICSP::Shell.new(
"#{certmgr} -inst -file '#{options[:file]}' -store #{store} #{not_crl ? '' : '-crl'}", convert_to_utf8: false
).execute
exit(result.exit_code) unless result.ok
puts result
end
|
#selected_container ⇒ Object
38
39
40
|
# File 'lib/commands/certificate/install.rb', line 38
def selected_container
::ICSP::Commands::Container::List.new(config: config, options: options, arguments: arguments).select
end
|