You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.5 KiB
66 lines
1.5 KiB
from calculate.vars.datavars import Variable, Namespace, HashVariable, TableVariable
|
|
|
|
|
|
class Linux(Namespace):
|
|
class Shortname(Variable):
|
|
value = ""
|
|
|
|
class Ver(Variable):
|
|
value = ""
|
|
|
|
class Fullname(Variable):
|
|
value = ""
|
|
|
|
class Subname(Variable):
|
|
value = ""
|
|
|
|
class Arch(Variable):
|
|
value = ""
|
|
|
|
class Test(Variable):
|
|
value = ""
|
|
|
|
class Title(Variable):
|
|
def get(self):
|
|
subname = self.vars.subname.get_value(self)
|
|
fullname = self.vars.fullname.get_value(self)
|
|
ver = self.vars.ver.get_value(self)
|
|
if subname:
|
|
return "%s %s %s" % (fullname, subname, ver)
|
|
else:
|
|
return "%s %s" % (fullname, ver)
|
|
|
|
|
|
class Hashvar(HashVariable):
|
|
class Data(HashVariable.Data):
|
|
def get(self):
|
|
return {
|
|
'value1': 'test1',
|
|
'value2': 'test2',
|
|
}
|
|
|
|
class Calculate(Variable):
|
|
def get(self):
|
|
return "%s %s" % (
|
|
self.vars.value1.get_value(self),
|
|
self.vars.value2.get_value(self)
|
|
)
|
|
|
|
hash_vars = ["value1", "value2"]
|
|
|
|
|
|
class Tablevar(TableVariable):
|
|
class Data(TableVariable.Data):
|
|
def get(self):
|
|
return [
|
|
{
|
|
"dev": "/dev/sdb1",
|
|
"mount": "/",
|
|
},
|
|
{
|
|
"dev": "/dev/sdb2",
|
|
"mount": "/var/calculate",
|
|
}
|
|
]
|
|
hash_vars = ["dev", "mount"]
|