from jinja2 import Environment, PackageLoader, select_autoescape
from lftools import config
-from lftools.api.endpoints.gerrit import Gerrit as gerrit_api
log = logging.getLogger(__name__)
gerrit_project test/test1
issue_id: CIMAN-33
"""
- gerrit_api.sanity_check(None, self.fqdn, gerrit_project)
filename = ".gitreview"
jinja_env = Environment(loader=PackageLoader("lftools.git"), autoescape=select_autoescape())
creds_path = "serverCredentialMappings.yaml"
content_path = "content"
sb_creds_path = "serverCredentialMappings.sandbox.yaml"
- nexus3_ports = nexus3_ports.split(",")
try:
default_servers = config.get_setting(self.fqdn, "default_servers")
nexus3_ports = nexus3_ports.split(",")
except configparser.NoOptionError:
nexus3_ports = ["10001", "10002", "10003", "10004"]
+ elif nexus3_ports:
+ try:
+ nexus3_ports = nexus3_ports.split(",")
+ except AttributeError:
+ log.error("Invalid nexus3_ports designated.")
jinja_env = Environment(loader=PackageLoader("lftools.git"), autoescape=select_autoescape())
template = jinja_env.get_template(params_path)
--- /dev/null
+---
+fixes:
+ - |
+ Only attempt to split nexus3_ports after we've checked that they exist, and
+ wrap that attempt in a try/except so that bad ports won't break other parts
+ of the job.
+ - |
+ Remove all instances of the gerrit_api.sanity_check function. This is too
+ tightly coupled with other parts of the Gerrit API, and does not perform
+ correctly in the git class.
import pytest
-from lftools.git.gerrit import Gerrit, Repo, gerrit_api
+from lftools.git.gerrit import Gerrit, Repo
FIXTURE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "fixtures")
mocker.patch.object(Gerrit, "add_file")
mocker.patch.object(Gerrit, "commit")
- mocker.patch.object(gerrit_api, "sanity_check")
mock_init.add_git_review(fqdn, gerrit_project, issue_id)