lib/testlab/node/status.rb in testlab-1.12.0 vs lib/testlab/node/status.rb in testlab-1.13.0

- old
+ new

@@ -20,25 +20,36 @@ :provisioners => self.provisioners.map(&:to_s).collect{ |p| p.split('::').last }.join(',') } end def ok? - self.alive? or return false + self.dead? and return false result = true + if !self.lxc.installed? + # @ui.stderr.puts(format_message("ERROR: ")) + raise NodeError, "LXC does not appear to be installed on your TestLab node! (Did you forget to provision or build the node?)" + # result = false + end + # make sure the node has some free space free_space_percent = (self.exec(%(df -P /), :ignore_exit_status => true).output.split("\n")[1].split[-2].to_i rescue nil) if free_space_percent.nil? @ui.stderr.puts(format_message("ERROR: We could not determine how much free space node #{self.id.inspect} has!".red.bold)) result = false elsif (free_space_percent >= 90) @ui.stderr.puts(format_message("WARNING: Your TestLab node #{self.id.inspect} is using #{free_space_percent}% of its available disk space!".red.bold)) result = false end + # get the names of all of the defined containers my_container_names = self.containers.map(&:id) - node_container_names = self.lxc.containers.map(&:name) + + # ephemeral containers parent containers have a "-master" suffix; we need to remove these from the results or we will complain about them + node_container_names = self.lxc.containers.map(&:name).delete_if do |node_container_name| + my_container_names.any?{ |my_container_name| "#{my_container_name}-master" == node_container_name } + end unknown_container_names = (node_container_names - my_container_names) unknown_running_container_names = self.lxc.containers.select{ |c| (unknown_container_names.include?(c.name) && (c.state == :running)) }.map(&:name) if unknown_container_names.count > 0