Ejemplo n.º 1
0
def set_rowselection(ident, rows, action):
    vo = config.load_user_file("rowselection/%s" % selection_id(), {})

    if action == 'set':
        vo[ident] = rows

    elif action == 'add':
        vo[ident] = list(set(vo.get(ident, [])).union(rows))

    elif action == 'del':
        vo[ident] = list(set(vo.get(ident, [])) - set(rows))

    elif action == 'unset':
        del vo[ident]

    if not os.path.exists(config.user_confdir + '/rowselection'):
        make_nagios_directory(config.user_confdir + '/rowselection')

    config.save_user_file("rowselection/%s" % selection_id(), vo)
Ejemplo n.º 2
0
def set_rowselection(ident, rows, action):
    vo = config.load_user_file("rowselection/%s" % selection_id(), {})

    if action == 'set':
        vo[ident] = rows

    elif action == 'add':
        vo[ident] = list(set(vo.get(ident, [])).union(rows))

    elif action == 'del':
        vo[ident] = list(set(vo.get(ident, [])) - set(rows))

    elif action == 'unset':
        del vo[ident]

    if not os.path.exists(config.user_confdir + '/rowselection'):
        make_nagios_directory(config.user_confdir + '/rowselection')

    config.save_user_file("rowselection/%s" % selection_id(), vo)
Ejemplo n.º 3
0
 def save(self, keys):
     make_nagios_directory(os.path.dirname(self._path))
     out = create_user_file(self._path, "w")
     out.write("# Written by WATO\n# encoding: utf-8\n\n")
     out.write("%s.update(%s)\n\n" % (self._attr, pprint.pformat(keys)))
Ejemplo n.º 4
0
 def save(self, keys):
     make_nagios_directory(os.path.dirname(self._path))
     out = create_user_file(self._path, "w")
     out.write("# Written by WATO\n# encoding: utf-8\n\n")
     out.write("%s.update(%s)\n\n" % (self._attr, pprint.pformat(keys)))
Ejemplo n.º 5
0
 def save(self, keys):
     make_nagios_directory(os.path.dirname(self._path))
     # TODO: Recode to store. functions. But this is also used in appliance code, do we have cma system wide available?
     out = create_user_file(self._path, "w")
     out.write("# Written by WATO\n# encoding: utf-8\n\n")
     out.write("%s.update(%s)\n\n" % (self._attr, pprint.pformat(keys)))