diff mbox series

[2/2] send-error-report: Drop --no-ssl

Message ID 20250414024111.141648-2-jaeyoon.jung@lge.com
State New
Headers show
Series [1/2] send-error-report: Respect URL scheme in server name if exists | expand

Commit Message

From: Jaeyoon Jung <jaeyoon.jung@lge.com>

A server name from -s or --server flag needs to contain a leading string
for URL scheme either http:// or https://. --no-ssl flag is dropped as
it is no longer needed.

Signed-off-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
---
 scripts/send-error-report | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)
diff mbox series

Patch

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):
     print(response.read().decode('utf-8'))
 
 
-def determine_server_url(args):
+def validate_server_url(args):
     # Get the error report server from an argument
-    server = args.server or 'errors.yoctoproject.org'
+    server = args.server or 'https://errors.yoctoproject.org'
 
-    # The scheme contained in the given URL takes precedence over --no-ssl flag
-    scheme = args.protocol
-    if server.startswith('http://'):
-        server = server[len('http://'):]
-        scheme = 'http://'
-    elif server.startswith('https://'):
-        server = server[len('https://'):]
-        scheme = 'https://'
+    if not server.startswith('http://') and not server.startswith('https://'):
+        log.error("Missing a URL scheme either http:// or https:// in the server name: " + server)
+        sys.exit(1)
 
     # Construct the final URL
-    return f"{scheme}{server}"
+    return f"{server}"
 
 
 if __name__ == '__main__':
@@ -206,14 +201,9 @@  if __name__ == '__main__':
                            help="Return the result in json format, silences all other output",
                            action="store_true")
 
-    arg_parse.add_argument("--no-ssl",
-                           help="Use http instead of https protocol",
-                           dest="protocol",
-                           action="store_const", const="http://", default="https://")
-
     args = arg_parse.parse_args()
 
-    args.server = determine_server_url(args)
+    args.server = validate_server_url(args)
 
     if (args.json == False):
         print("Preparing to send errors to: "+args.server)