New action variables

master3.3
parent ad1bd0cfec
commit a9ccef8571

@ -17,44 +17,52 @@
import os
import sys
from os import path
from calculate.lib.datavars import Variable,VariableError,ReadonlyVariable
from calculate.lib.datavars import (Variable,VariableError,ReadonlyVariable,
ActionVariable)
from calculate.lib.cl_lang import setLocalTranslate
setLocalTranslate('cl_client3',sys.modules[__name__])
class VariableAcClientMerge(ReadonlyVariable):
class VariableAcClientMerge(ActionVariable):
"""
Action variable which has value "up" for package install and
install this package
"""
def get(self):
ret = ""
action = self.Get("cl_action")
nonchroot, postinst = True,True
def action(self,cl_action):
if cl_action in ("merge","domain","undomain"):
ret = "on"
return "off"
class VariableAcClientDomain(ActionVariable):
"""
Action variable which has value "on" for domain action
"""
nonchroot, postinst = True,True
def action(self,cl_action):
remoteHost = self.Get("cl_remote_host")
remoteAuth = self.Get("os_remote_auth")
if action in ("merge","install","domain","undomain"):
ret = "up"
return ret
if cl_action == "domain":
return "on"
elif cl_action == "merge" and \
remoteHost and remoteAuth:
return "on"
return "off"
class VariableAcClientDomain(ReadonlyVariable):
class VariableAcClientUndomain(ActionVariable):
"""
Action variable which has value "up" for domain action
and "down" for undomain action
Action variable which has value "on" for undomain action
"""
def get(self):
ret = ""
if self.Get('cl_chroot_status') == "on":
return ""
action = self.Get("cl_action")
nonchroot, postinst = True,True
def action(self,cl_action):
remoteHost = self.Get("cl_remote_host")
remoteAuth = self.Get("os_remote_auth")
if action == "domain":
return "up"
elif action in ("undomain", "uninstall"):
return "down"
elif action in ("install", "merge"):
if remoteHost and remoteAuth:
return "up"
else:
return "down"
return ""
if cl_action in ("undomain",):
return "on"
elif cl_action in ("merge",) and \
(not remoteHost or not remoteAuth):
return "on"
return "off"

Loading…
Cancel
Save