|
Lines 48-54
from univention.admin.handlers.computers import domaincontroller_backup
Link Here
|
| 48 |
|
48 |
|
| 49 |
|
49 |
|
| 50 |
# local application |
50 |
# local application |
| 51 |
from constants import COMPONENT_BASE, COMP_PARTS, COMP_PARAMS, STATUS_ICONS, DEFAULT_ICON, PUT_SUCCESS, PUT_PROCESSING_ERROR |
51 |
from constants import COMPONENT_BASE, COMP_PARAMS, STATUS_ICONS, DEFAULT_ICON, PUT_SUCCESS, PUT_PROCESSING_ERROR |
| 52 |
|
52 |
|
| 53 |
def get_hosts(module, lo, ucr=None): |
53 |
def get_hosts(module, lo, ucr=None): |
| 54 |
hosts = module.lookup(None, lo, None) |
54 |
hosts = module.lookup(None, lo, None) |
|
Lines 275-282
class ComponentManager(object):
Link Here
|
| 275 |
""" |
275 |
""" |
| 276 |
entry = {} |
276 |
entry = {} |
| 277 |
entry['name'] = component_id |
277 |
entry['name'] = component_id |
| 278 |
for part in COMP_PARTS: |
|
|
| 279 |
entry[part] = False |
| 280 |
# ensure a proper bool |
278 |
# ensure a proper bool |
| 281 |
entry['enabled'] = self.ucr.is_true('%s/%s' % (COMPONENT_BASE, component_id), False) |
279 |
entry['enabled'] = self.ucr.is_true('%s/%s' % (COMPONENT_BASE, component_id), False) |
| 282 |
# Most values that can be fetched unchanged |
280 |
# Most values that can be fetched unchanged |
|
Lines 285-297
class ComponentManager(object):
Link Here
|
| 285 |
entry[attr] = self.ucr.get(regstr, '') |
283 |
entry[attr] = self.ucr.get(regstr, '') |
| 286 |
# Get default packages (can be named either defaultpackage or defaultpackages) |
284 |
# Get default packages (can be named either defaultpackage or defaultpackages) |
| 287 |
entry['defaultpackages'] = list(self.uu.get_component_defaultpackage(component_id)) # method returns a set |
285 |
entry['defaultpackages'] = list(self.uu.get_component_defaultpackage(component_id)) # method returns a set |
| 288 |
# Parts value (if present) must be splitted into words and added as bools. |
286 |
# Explicitly enable unmaintained component |
| 289 |
# For parts not contained here we have set 'False' default values. |
287 |
entry['unmaintained'] = self.ucr.is_true('%s/%s/unmaintained' % (COMPONENT_BASE, component_id), False) |
| 290 |
parts = self.ucr.get('%s/%s/parts' % (COMPONENT_BASE, component_id), '').split(',') |
|
|
| 291 |
for part in parts: |
| 292 |
p = part.strip() |
| 293 |
if len(p): |
| 294 |
entry[p] = True |
| 295 |
# Component status as a symbolic string |
288 |
# Component status as a symbolic string |
| 296 |
entry['status'] = self.uu.get_current_component_status(component_id) |
289 |
entry['status'] = self.uu.get_current_component_status(component_id) |
| 297 |
entry['installed'] = self.uu.is_component_defaultpackage_installed(component_id) |
290 |
entry['installed'] = self.uu.is_component_defaultpackage_installed(component_id) |
|
Lines 317-323
class ComponentManager(object):
Link Here
|
| 317 |
app_data = { |
310 |
app_data = { |
| 318 |
'server' : app.get_server(), |
311 |
'server' : app.get_server(), |
| 319 |
'prefix' : '', |
312 |
'prefix' : '', |
| 320 |
'maintained' : True, |
|
|
| 321 |
'unmaintained' : False, |
313 |
'unmaintained' : False, |
| 322 |
'enabled' : True, |
314 |
'enabled' : True, |
| 323 |
'name' : app.component_id, |
315 |
'name' : app.component_id, |
|
Lines 350-362
class ComponentManager(object):
Link Here
|
| 350 |
'object': {}, |
342 |
'object': {}, |
| 351 |
} |
343 |
} |
| 352 |
try: |
344 |
try: |
| 353 |
parts = set() |
|
|
| 354 |
name = data.pop('name') |
345 |
name = data.pop('name') |
| 355 |
named_component_base = '%s/%s' % (COMPONENT_BASE, name) |
346 |
named_component_base = '%s/%s' % (COMPONENT_BASE, name) |
| 356 |
old_parts = self.ucr.get('%s/parts' % named_component_base, '') |
|
|
| 357 |
if old_parts: |
| 358 |
for part in old_parts.split(','): |
| 359 |
parts.add(part) |
| 360 |
for key, val in data.iteritems(): |
347 |
for key, val in data.iteritems(): |
| 361 |
if val is None: |
348 |
if val is None: |
| 362 |
# was not given, so dont update |
349 |
# was not given, so dont update |
|
Lines 365-376
class ComponentManager(object):
Link Here
|
| 365 |
super_ucr.set_registry_var('%s/%s' % (named_component_base, key), val) |
352 |
super_ucr.set_registry_var('%s/%s' % (named_component_base, key), val) |
| 366 |
elif key == 'enabled': |
353 |
elif key == 'enabled': |
| 367 |
super_ucr.set_registry_var(named_component_base, val) |
354 |
super_ucr.set_registry_var(named_component_base, val) |
| 368 |
elif key in COMP_PARTS: |
|
|
| 369 |
if val: |
| 370 |
parts.add(key) |
| 371 |
else: |
| 372 |
parts.discard(key) |
| 373 |
super_ucr.set_registry_var('%s/parts' % named_component_base, ','.join(sorted(parts))) |
| 374 |
except Exception as e: |
355 |
except Exception as e: |
| 375 |
result['status'] = PUT_PROCESSING_ERROR |
356 |
result['status'] = PUT_PROCESSING_ERROR |
| 376 |
result['message'] = "Parameter error: %s" % str(e) |
357 |
result['message'] = "Parameter error: %s" % str(e) |
|
Lines 400-408
class ComponentManager(object):
Link Here
|
| 400 |
|
381 |
|
| 401 |
def _remove(self, component_id, super_ucr): |
382 |
def _remove(self, component_id, super_ucr): |
| 402 |
named_component_base = '%s/%s' % (COMPONENT_BASE, component_id) |
383 |
named_component_base = '%s/%s' % (COMPONENT_BASE, component_id) |
| 403 |
for var in COMP_PARAMS + ['parts']: |
384 |
for var in COMP_PARAMS: |
| 404 |
# COMP_PARTS (maintained,unmaintained) are special |
|
|
| 405 |
# '' deletes this variable |
| 406 |
super_ucr.set_registry_var('%s/%s' % (named_component_base, var), '') |
385 |
super_ucr.set_registry_var('%s/%s' % (named_component_base, var), '') |
| 407 |
|
386 |
|
| 408 |
super_ucr.set_registry_var(named_component_base, '') |
387 |
super_ucr.set_registry_var(named_component_base, '') |