mirror of
https://github.com/inspec/inspec
synced 2025-02-16 22:18:38 +00:00
CFINSPEC-85: Extend docker_container with have_volume? matcher
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
parent
4f691564e4
commit
e3295743f1
1 changed files with 10 additions and 0 deletions
|
@ -43,6 +43,10 @@ module Inspec::Resources
|
|||
status.downcase.start_with?("up") if object_info.entries.length == 1
|
||||
end
|
||||
|
||||
def has_volume?(destination, source)
|
||||
volume_info.Mounts[0].Destination == destination && volume_info.Mounts[0].Source == source
|
||||
end
|
||||
|
||||
def status
|
||||
object_info.status[0] if object_info.entries.length == 1
|
||||
end
|
||||
|
@ -87,5 +91,11 @@ module Inspec::Resources
|
|||
opts = @opts
|
||||
@info = inspec.docker.containers.where { names == opts[:name] || (!id.nil? && !opts[:id].nil? && (id == opts[:id] || id.start_with?(opts[:id]))) }
|
||||
end
|
||||
|
||||
def volume_info
|
||||
return @mount_info if defined?(@mount_info)
|
||||
|
||||
@mount_info = inspec.docker.object(@opts[:name] || (!id.nil? && !opts[:id].nil? && (id == opts[:id] || id.start_with?(opts[:id]))))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue