Esempio n. 1
0
        def set(self, value):
            value = read_value(value, self.type)
            if self.choices is not None and value not in self.choices:
                raise ValueError(
                    _("Value not on the list of possible choices"))

            self.value = value
Esempio n. 2
0
    def do_set(self, obj, value):
        value = read_value(value, self.type)
        if callable(self.set):
            self.set(obj, value)
            return

        obj[self.set] = value
Esempio n. 3
0
        def set(self, value):
            value = read_value(value, self.type)
            if self.choices is not None and value not in self.choices:
                raise ValueError(
                    _("Value not on the list of possible choices"))

            self.value = value
Esempio n. 4
0
    def do_set(self, obj, value):
        value = read_value(value, self.type)
        if callable(self.set):
            self.set(obj, value)
            return

        obj[self.set] = value
Esempio n. 5
0
 def run(self, context, args, kwargs, opargs):
     erase_data = read_value(kwargs.pop('wipe', 'no'), ValueType.BOOLEAN)
     context.submit_task('disks.erase', self.parent.entity['path'], erase_data)
Esempio n. 6
0
 def run(self, context, args, kwargs, opargs):
     erase_data = read_value(kwargs.pop('wipe', 'no'), ValueType.BOOLEAN)
     context.submit_task('disks.erase', self.parent.entity['path'],
                         erase_data)
Esempio n. 7
0
    def do_remove(self, obj, value):
        if self.type != ValueType.ARRAY:
            raise ValueError('Property is not an array')

        value = read_value(value, self.type)
Esempio n. 8
0
    def do_append(self, obj, value):
        if self.type != ValueType.ARRAY:
            raise ValueError('Property is not an array')

        value = read_value(value, self.type)
        self.set(obj, self.get(obj).append(value))
Esempio n. 9
0
    def do_remove(self, obj, value):
        if self.type != ValueType.ARRAY:
            raise ValueError('Property is not an array')

        value = read_value(value, self.type)
Esempio n. 10
0
    def do_append(self, obj, value):
        if self.type != ValueType.ARRAY:
            raise ValueError('Property is not an array')

        value = read_value(value, self.type)
        self.set(obj, self.get(obj).append(value))