mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +00:00
Automate version command fix
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
This commit is contained in:
parent
14db8ff057
commit
d11e5dd1af
2 changed files with 5 additions and 4 deletions
|
@ -84,7 +84,7 @@ module InspecPlugins
|
|||
return {} if data.nil? || data.empty?
|
||||
|
||||
parsed = JSON.parse(data)
|
||||
return {} unless parsed.key?("version") && !parsed["version"].empty?
|
||||
return {} unless parsed.key?("build_timestamp") && !parsed["build_timestamp"].empty?
|
||||
|
||||
parsed
|
||||
end
|
||||
|
|
|
@ -219,9 +219,10 @@ module InspecPlugins
|
|||
def version
|
||||
config = InspecPlugins::Compliance::Configuration.new
|
||||
info = InspecPlugins::Compliance::API.version(config)
|
||||
if !info.nil? && info["version"]
|
||||
puts "Name: #{info["api"]}"
|
||||
puts "Version: #{info["version"]}"
|
||||
if !info.nil? && info["build_timestamp"]
|
||||
# key info["api"] is not longer available in latest version api response
|
||||
puts "Name: Automate Version API"
|
||||
puts "Version: #{info["build_timestamp"]}"
|
||||
else
|
||||
puts "Could not determine server version."
|
||||
exit 1
|
||||
|
|
Loading…
Reference in a new issue