Module: Specinfra::Command::Module::Zfs

Included in:
Freebsd::Base::Zfs, Linux::Base::Zfs, Solaris::Base::Zfs
Defined in:
lib/specinfra/command/module/zfs.rb

Instance Method Summary collapse

Instance Method Details

#check_exists(zfs) ⇒ Object



5
6
7
# File 'lib/specinfra/command/module/zfs.rb', line 5

def check_exists(zfs)
    "zfs list -H #{escape(zfs)}"
end

#check_has_property(zfs, property = nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/specinfra/command/module/zfs.rb', line 9

def check_has_property(zfs, property=nil)
  commands = []
  property.sort.each do |key, value|
    regexp = "^#{value}$"
    commands << "zfs list -H -o #{escape(key)} #{escape(zfs)} | grep -- #{escape(regexp)}"
  end
  commands.join(' && ')
end

#get_property(zfs) ⇒ Object



18
19
20
# File 'lib/specinfra/command/module/zfs.rb', line 18

def get_property(zfs)
  "zfs get -Hp -o property,value all #{escape(zfs)}"
end