def update_bundles(useAuthentication, user, password, tracUrl, parentTicketsField, cwd): res = [] auth_ok = True with common_app_server.logging_redirect_for_webapp() as logs: try: repo = git.Repo(cwd) ensure_clean_git_repo(repo) tracApi = None try: if useAuthentication and user and len( user) > 0 and password and len(password) > 0: tracApi = trac_api.TracApi(tracUrl, user, password) else: logger.warn( "Skipping synchronisation with trac as there are no/empty credentials specified." ) auth_ok = False except KeyError as e: logger.warn( "Missing Key {} in local trac configuration --> no synchronization with trac will be done!" .format(e)) reprepro_bundle_compose.updateBundles( tracApi, parentTicketsField=parentTicketsField, cwd=cwd) git_commit(repo, [BUNDLES_LIST_FILE], "UPDATED {}".format(BUNDLES_LIST_FILE)) except GitNotCleanException as e: logger.error(e) except Exception as e: auth_ok = False logger.error(e) finally: res = logs.toBackendLogEntryList() return res, auth_ok
def mark_bundles_for_target(bundleIds, target, ignoreTargetFromInfoFile, cwd): res = [] with common_app_server.logging_redirect_for_webapp() as logs: try: repo = git.Repo(cwd) ensure_clean_git_repo(repo) bundles = parseBundles(getBundleRepoSuites(bundleIds, cwd=cwd), cwd=cwd) reprepro_bundle_compose.markBundlesForTarget( bundles, bundleIds, target, cwd, ignoreTargetFromInfoFile) msg = "MARKED for target '{}'\n\n - {}".format( target, "\n - ".join(sorted(bundleIds))) if len(bundleIds) == 1: msg = "MARKED {} for target '{}'".format( "".join(bundleIds), target) git_commit(repo, [BUNDLES_LIST_FILE], msg) except GitNotCleanException as e: logger.error(e) finally: res = logs.toBackendLogEntryList() return res
def mark_bundles_for_status(bundleIds, status, cwd): res = [] with common_app_server.logging_redirect_for_webapp() as logs: try: repo = git.Repo(cwd) ensure_clean_git_repo(repo) bundles = parseBundles(cwd=cwd) reprepro_bundle_compose.markBundlesForStatus(bundles, bundleIds, status, force=True, checkOwnSuite=False, cwd=cwd) msg = "MARKED for status '{}'\n\n - {}".format( status, "\n - ".join(sorted(bundleIds))) if len(bundleIds) == 1: msg = "MARKED {} for status '{}'".format( "".join(bundleIds), status) git_commit(repo, [BUNDLES_LIST_FILE], msg) except GitNotCleanException as e: logger.error(e) finally: res = logs.toBackendLogEntryList() return res