Skip to content

Commit ad1199a

Browse files
author
Vladimir Kotal
authored
failed requests should include URI (#2371)
fixes #2367
1 parent 8e6d60e commit ad1199a

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

tools/src/main/python/mirror.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@
124124

125125
source_root = get_config_value(logger, 'sourceRoot', uri)
126126
if not source_root:
127-
logger.error("Cannot get the sourceRoot config value")
128127
sys.exit(1)
129128

130129
logger.debug("Source root = {}".format(source_root))

tools/src/main/python/opengrok.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def get_config_value(logger, name, uri):
100100
urllib.parse.quote_plus(name)))
101101

102102
if not r:
103-
logger.error('could not get config value ' + name)
103+
logger.error("Cannot get the '{}' config value from the web "
104+
"application on {}".format(name, uri))
104105
return None
105106

106107
return r.text
@@ -117,7 +118,8 @@ def get_repo_type(logger, repository, uri):
117118
r = get(logger, get_uri(uri, 'api', 'v1', 'repositories', 'type'),
118119
params=payload)
119120
if not r:
120-
logger.error('could not get repo type for ' + repository)
121+
logger.error('could not get repository type for {} from web'
122+
'application on {}'.format(repository, uri))
121123
return None
122124

123125
line = r.text
@@ -129,7 +131,8 @@ def get_repo_type(logger, repository, uri):
129131
def get_configuration(logger, uri):
130132
r = get(logger, get_uri(uri, 'api', 'v1', 'configuration'))
131133
if not r:
132-
logger.error('could not get configuration')
134+
logger.error('could not get configuration from web application on {}'.
135+
format(uri))
133136
return None
134137

135138
return r.text
@@ -140,7 +143,8 @@ def set_configuration(logger, configuration, uri):
140143
data=configuration)
141144

142145
if not r:
143-
logger.error('could not set configuration')
146+
logger.error('could not set configuration for web application on {}'.
147+
format(uri))
144148
return False
145149

146150
return True
@@ -149,7 +153,8 @@ def set_configuration(logger, configuration, uri):
149153
def list_indexed_projects(logger, uri):
150154
r = get(logger, get_uri(uri, 'api', 'v1', 'projects', 'indexed'))
151155
if not r:
152-
logger.error('could not list indexed projects')
156+
logger.error('could not list indexed projects from web application '
157+
'on {}'.format(uri))
153158
return None
154159

155160
return r.json()
@@ -159,7 +164,8 @@ def add_project(logger, project, uri):
159164
r = post(logger, get_uri(uri, 'api', 'v1', 'projects'), data=project)
160165

161166
if not r:
162-
logger.error('could not add project ' + project)
167+
logger.error('could not add project {} for web application on {}'.
168+
format(project, uri))
163169
return False
164170

165171
return True
@@ -170,7 +176,8 @@ def delete_project(logger, project, uri):
170176
urllib.parse.quote_plus(project)))
171177

172178
if not r:
173-
logger.error('could not delete project ' + project)
179+
logger.error('could not delete project in web application on {}'.
180+
format(project, uri))
174181
return False
175182

176183
return True

0 commit comments

Comments
 (0)