lib/lxc.rb in lxc-0.4.1 vs lib/lxc.rb in lxc-0.5.0

- old
+ new

@@ -125,9 +125,23 @@ # @return [Array<String>] Output text of the "lxc-checkconfig" command. def checkconfig(*args) ZTK::ANSI.uncolor(self.exec("lxc-checkconfig", *args)).split("\n") end + # Linux containers installed? + # + # Checks the output of "lxc-checkconfig" to see if it returns a + # 'command not found' error. + # + # @return [Boolean] True if LXC is installed; false otherwise. + def installed? + if !!(self.checkconfig.join =~ /command not found/) + false + else + true + end + end + # Linux container command execution wrapper # # Runs the supplied LXC command. The first element in the "args" splat is the # command to be execute, the rest of the elements are treated as command line # arguments.