Sha256: 38e86fe11200803672383d52082b51281e1aba7d85bbf1cee023ac638225cb86

Contents?: true

Size: 723 Bytes

Versions: 2

Compression:

Stored size: 723 Bytes

Contents

#
# predefined methods: update_state, apply, reset, resolve
#
module Sfp::Resource
	attr_accessor :parent, :synchronized
	attr_reader :state, :model

	def init(model, default)
		@model = {}
		model.each { |k,v| @model[k] = v }
		@state = {}
		@default = {}
		@synchronized = []
	end

	def update_state
		@state = {}
	end

	def apply(p={})
		true
	end

	def to_model
		@state = {}
		@model.each { |k,v| @state[k] = v }
	end

	alias_method :reset, :to_model

	def resolve(path)
		Sfp::Agent.resolve(path.simplify)
	end

	protected
	def exec_seq(*commands)
		commands = [commands.to_s] if not commands.is_a?(Array)
		commands.each { |c| raise Exception, "Cannot execute: #{c}" if !system(c) }
	end
end

module Sfp::Module
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sfpagent-0.1.6 lib/sfpagent/module.rb
sfpagent-0.1.5 lib/sfpagent/module.rb