Sha256: dfa2694f10d2d7f639878a428255d0fbb48642579b904a04918c4e85c8f8786e

Contents?: true

Size: 958 Bytes

Versions: 6

Compression:

Stored size: 958 Bytes

Contents

def load_current_resource
  @lxc = ::Lxc.new(
    new_resource.name,
    :base_dir => node[:lxc][:container_directory],
    :dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
  )
  if(new_resource.service_name.to_s.empty?)
    new_resource.service_name new_resource.name
  end
end

action :start do
  if(@lxc.stopped?)
    @lxc.start
    new_resource.updated_by_last_action(true)
  end
end

action :halt do
  if(@lxc.running?)
    @lxc.stop
    new_resource.updated_by_last_action(true)
  end
end

action :restart do
  if(@lxc.running?)
    @lxc.shutdown
  end
  @lxc.start
  new_resource.updated_by_last_action(true)
end

action :stop do
  if(@lxc.running?)
    @lxc.stop
    new_resource.updated_by_last_action(true)
  end
end

action :freeze do
  if(@lxc.running?)
    @lxc.freeze
    new_resource.updated_by_last_action(true)
  end
end

action :unfreeze do
  if(@lxc.frozen?)
    @lxc.unfreeze
    new_resource.updated_by_last_action(true)
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vagabond-0.2.8 lib/vagabond/cookbooks/lxc/providers/service.rb
vagabond-0.2.6 lib/vagabond/cookbooks/lxc/providers/service.rb
vagabond-0.2.4 lib/vagabond/cookbooks/lxc/providers/service.rb
vagabond-0.2.2 lib/vagabond/cookbooks/lxc/providers/service.rb
elecksee-1.0.2 lib/elecksee/vendor/lxc/providers/service.rb
elecksee-1.0.0 lib/elecksee/vendor/lxc/providers/service.rb