summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/send-error-report24
1 files changed, 7 insertions, 17 deletions
diff --git a/scripts/send-error-report b/scripts/send-error-report
index f8bf51a491..efb7e9630f 100755
--- a/scripts/send-error-report
+++ b/scripts/send-error-report
@@ -149,21 +149,16 @@ def send_data(data, args):
149 print(response.read().decode('utf-8')) 149 print(response.read().decode('utf-8'))
150 150
151 151
152def determine_server_url(args): 152def validate_server_url(args):
153 # Get the error report server from an argument 153 # Get the error report server from an argument
154 server = args.server or 'errors.yoctoproject.org' 154 server = args.server or 'https://errors.yoctoproject.org'
155 155
156 # The scheme contained in the given URL takes precedence over --no-ssl flag 156 if not server.startswith('http://') and not server.startswith('https://'):
157 scheme = args.protocol 157 log.error("Missing a URL scheme either http:// or https:// in the server name: " + server)
158 if server.startswith('http://'): 158 sys.exit(1)
159 server = server[len('http://'):]
160 scheme = 'http://'
161 elif server.startswith('https://'):
162 server = server[len('https://'):]
163 scheme = 'https://'
164 159
165 # Construct the final URL 160 # Construct the final URL
166 return f"{scheme}{server}" 161 return f"{server}"
167 162
168 163
169if __name__ == '__main__': 164if __name__ == '__main__':
@@ -206,14 +201,9 @@ if __name__ == '__main__':
206 help="Return the result in json format, silences all other output", 201 help="Return the result in json format, silences all other output",
207 action="store_true") 202 action="store_true")
208 203
209 arg_parse.add_argument("--no-ssl",
210 help="Use http instead of https protocol",
211 dest="protocol",
212 action="store_const", const="http://", default="https://")
213
214 args = arg_parse.parse_args() 204 args = arg_parse.parse_args()
215 205
216 args.server = determine_server_url(args) 206 args.server = validate_server_url(args)
217 207
218 if (args.json == False): 208 if (args.json == False):
219 print("Preparing to send errors to: "+args.server) 209 print("Preparing to send errors to: "+args.server)