|
Lines 37-42
Link Here
|
| 37 |
import optparse |
37 |
import optparse |
| 38 |
import subprocess |
38 |
import subprocess |
| 39 |
import traceback |
39 |
import traceback |
|
|
40 |
import logging |
| 40 |
|
41 |
|
| 41 |
import univention.config_registry |
42 |
import univention.config_registry |
| 42 |
|
43 |
|
|
Lines 271-276
Link Here
|
| 271 |
else: |
272 |
else: |
| 272 |
dprint(silent, 'none') |
273 |
dprint(silent, 'none') |
| 273 |
|
274 |
|
|
|
275 |
####################################################################### |
| 276 |
# APP UPDATE |
| 277 |
####################################################################### |
| 278 |
try: |
| 279 |
from univention.appcenter.actions import get_action |
| 280 |
import univention.appcenter.log as appcenter_log |
| 281 |
from argparse import Namespace |
| 282 |
app_upgrade = get_action('upgrade') |
| 283 |
if app_upgrade is None: |
| 284 |
raise ImportError() |
| 285 |
except ImportError: |
| 286 |
# the new univention.appcenter package is not installed. nevermind |
| 287 |
# cannot be a dependency as the app center depends on updater... |
| 288 |
pass |
| 289 |
else: |
| 290 |
# check if component updates are available |
| 291 |
dprint(silent, 'Checking for app updates: ', newline=False) |
| 292 |
app_upgrade = app_upgrade() |
| 293 |
appcenter_log.log_to_logfile() |
| 294 |
appcenter_log._reverse_umc_module_logger() |
| 295 |
|
| 296 |
# own logging |
| 297 |
handler = logging.FileHandler(LOGFN) |
| 298 |
appcenter_log.get_base_logger().addHandler(handler) |
| 299 |
logger = logging.getLogger('univention.appcenter.actions.upgrade.readme') |
| 300 |
handler = logging.StreamHandler(sys.stdout) |
| 301 |
handler.setLevel(logging.INFO) |
| 302 |
logger.addHandler(handler) |
| 303 |
|
| 304 |
new_apps = list(app_upgrade.iter_upgradable_apps()) |
| 305 |
update_available = bool(new_apps) |
| 306 |
|
| 307 |
if update_available: |
| 308 |
# updates available ==> stop here in "check-mode" |
| 309 |
if checkForUpdates: |
| 310 |
dprint(silent, 'found') |
| 311 |
return True |
| 312 |
|
| 313 |
dprint(silent, 'found\n') |
| 314 |
dprint(silent, 'The following apps can be updated:\n') |
| 315 |
for app in new_apps: |
| 316 |
dprint(silent, '%(name)s: Version %(old)s can be updated to %(new)s' % {'name': app.name, 'old': app.version, 'new': app.candidate.version}) |
| 317 |
dprint(silent, 'Starting univention-app update at %s...' % (time.ctime()), debug=True) |
| 318 |
dprint(silent, '\nStarting app update', newline=False) |
| 319 |
success = True |
| 320 |
for app in new_apps: |
| 321 |
if interactive: |
| 322 |
run_app = readcontinue('\nDo you want to update %s [Y|n]?' % app.name) |
| 323 |
if run_app: |
| 324 |
time.sleep(1) |
| 325 |
|
| 326 |
success = app_upgrade.call(app=app, noninteractive=not interactive) and success |
| 327 |
|
| 328 |
if not success: |
| 329 |
dprint(silent, 'ERROR: app upgrade failed. Please check /var/log/univention/updater.log\n') |
| 330 |
sys.exit(1) |
| 331 |
dprint(silent, 'univention-app upgrade finished at %s...' % (time.ctime()), debug=True) |
| 332 |
dprint(silent, 'done') |
| 333 |
time.sleep(1) |
| 334 |
else: |
| 335 |
dprint(silent, 'none') |
| 336 |
|
| 274 |
# updates available ==> stop here in "check-mode" |
337 |
# updates available ==> stop here in "check-mode" |
| 275 |
if checkForUpdates: |
338 |
if checkForUpdates: |
| 276 |
return False |
339 |
return False |