Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.session.mount('http://', HTTPAdapter(max_retries=retries))
self.session.mount('https://', HTTPAdapter(max_retries=retries))
self.session.verify = self.ssl_verify
try:
version = self._make_requests_to_api("version")
logging.info("Connected to GitLab version: %s (%s)" % (version['version'], version['revision']))
except Exception as e:
raise TestRequestFailedException(e)
try:
api_version = configuration.get("gitlab|api_version")
if api_version != 4:
raise ApiVersionIncorrectException(e)
logging.info("Config file is declared to be compatible with GitLab API v4")
except KeyNotFoundException:
logging.fatal("Aborting. GitLabForm 1.0.0 has switched from GitLab API v3 to v4 in which some parameter "
"names have changed. By its design GitLabForm reads some parameter names directly from "
"config.yml so you need to update those names by yourself. See changes in config.yml "
"in this diff to see what had to be changed there: "
"https://github.com/egnyte/gitlabform/pull/28/files . "
"After updating your config.yml please add 'api_version' key to 'gitlab' section and set it "
"to 4 to indicate that your config is v4-compatible.")
sys.exit(3)
To get the dict under it use: get("group_settings|sddc|deploy_keys")
:return: element from YAML file (dict, array, string...)
"""
tokens = path.split('|')
current = self.config_from_file
try:
for token in tokens:
current = current[token]
except:
if default is not None:
return default
else:
raise KeyNotFoundException
return current
def get_project_config(self, group_and_project) -> dict:
"""
:param group_and_project: 'group/project'
:return: literal configuration for this project or empty dict if not defined
"""
try:
return self.get("project_settings|%s" % group_and_project)
except KeyNotFoundException:
return {}