end
local state = table.remove(self.done)
+ if not state.rollback then
+ return true
+ end
+
local ret, err = pcall(state.rollback, state, self.register)
if ret then
function Task.step(self)
local state = table.remove(self.work)
- local ret, next = pcall(state.process, state, self.register)
+ local ret, next = pcall(state.process, self.register)
if ret then
if next then
table.insert(self.work, state)
table.insert(self.work, nstate)
else
- self.register.error = "Unknown state: " .. next
+ self.register.error = 2
+ self.register.errstr = "Unknown state: " .. next
return false
end
else
local register = {}
- return start:entry(register) and Task(self, register, start)
+ return start.entry(register, ...) and Task(self, register, start)
end
+module("luci.lpk.core.install", package.seeall)
+
+function entry(register, ...)
+ print("Requested install of " .. table.concat(arg, ", "))
+ return true
+end
+
+function process(register)
+ register.sometext = "Test"
+ if not register.retreived then
+ print("Step down to retreive")
+ return "retreive"
+ else
+ print("Coming up again")
+ end
+end
\ No newline at end of file
+module("luci.lpk.core.retreive", package.seeall)
+
+function process(register)
+ print "Now in retreive"
+ print (register.sometext)
+ register.retreived = true
+end
\ No newline at end of file