Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] send-error-report: Add --no-ssl to use http protocol
@ 2019-03-04 10:48 Robert Yang
  2019-03-04 10:49 ` [PATCH 1/1] " Robert Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Yang @ 2019-03-04 10:48 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit 9ad19eb12c24d1ddc967215af0ebafd2cd2cb665:

  mcextend: Add helper class useful for multiconfig (2019-03-03 15:38:08 +0000)

are available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib rbt/error
  http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/error

Robert Yang (1):
  send-error-report: Add --no-ssl to use http protocol

 scripts/send-error-report | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] send-error-report: Add --no-ssl to use http protocol
  2019-03-04 10:48 [PATCH 0/1] send-error-report: Add --no-ssl to use http protocol Robert Yang
@ 2019-03-04 10:49 ` Robert Yang
  2019-03-04 10:56   ` Burton, Ross
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Yang @ 2019-03-04 10:49 UTC (permalink / raw)
  To: openembedded-core

The script use https protocol by default, but the error-report-web server's
https connection may not work (e.g., doesn't work with python 2.7.6), so add an
option --no-ssl to make it use http.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 scripts/send-error-report | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/scripts/send-error-report b/scripts/send-error-report
index 3528cf9..f8039b8 100755
--- a/scripts/send-error-report
+++ b/scripts/send-error-report
@@ -60,9 +60,9 @@ def edit_content(json_file_path):
         return True
     return False
 
-def prepare_data(args):
+def prepare_data(args, protocol):
     # attempt to get the max_log_size from the server's settings
-    max_log_size = getPayloadLimit("https://"+args.server+"/ClientPost/JSON")
+    max_log_size = getPayloadLimit(protocol+args.server+"/ClientPost/JSON")
 
     if not os.path.isfile(args.error_file):
         log.error("No data file found.")
@@ -128,13 +128,13 @@ def prepare_data(args):
     return data.encode('utf-8')
 
 
-def send_data(data, args):
+def send_data(data, args, protocol):
     headers={'Content-type': 'application/json', 'User-Agent': "send-error-report/"+version}
 
     if args.json:
-        url = "https://"+args.server+"/ClientPost/JSON/"
+        url = protocol+args.server+"/ClientPost/JSON/"
     else:
-        url = "https://"+args.server+"/ClientPost/"
+        url = protocol+args.server+"/ClientPost/"
 
     req = urllib.request.Request(url, data=data, headers=headers)
     try:
@@ -187,6 +187,10 @@ 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",
+                           action="store_true")
+
 
 
     args = arg_parse.parse_args()
@@ -194,7 +198,12 @@ if __name__ == '__main__':
     if (args.json == False):
         print("Preparing to send errors to: "+args.server)
 
-    data = prepare_data(args)
-    send_data(data, args)
+    if args.no_ssl:
+        protocol = "http://"
+    else:
+        protocol = "https://"
+
+    data = prepare_data(args, protocol)
+    send_data(data, args, protocol)
 
     sys.exit(0)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] send-error-report: Add --no-ssl to use http protocol
  2019-03-04 10:49 ` [PATCH 1/1] " Robert Yang
@ 2019-03-04 10:56   ` Burton, Ross
  2019-03-04 11:43     ` Yang, Liezhi
  0 siblings, 1 reply; 4+ messages in thread
From: Burton, Ross @ 2019-03-04 10:56 UTC (permalink / raw)
  To: Robert Yang; +Cc: OE-core

On Mon, 4 Mar 2019 at 10:30, Robert Yang <liezhi.yang@windriver.com> wrote:
> +    arg_parse.add_argument("--no-ssl",
> +                           help="Use http instead of https protocol",
> +                           action="store_true")

If you do this instead:

arg_parse.add_argument("--no-ssl", help="Use http instead of https protocol",
      dest="protocol", action="store_const", const="http", default="https")

Then you can just use args.protocol instead of having to pass around
the protocol name.

Ross


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] send-error-report: Add --no-ssl to use http protocol
  2019-03-04 10:56   ` Burton, Ross
@ 2019-03-04 11:43     ` Yang, Liezhi
  0 siblings, 0 replies; 4+ messages in thread
From: Yang, Liezhi @ 2019-03-04 11:43 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

Thanks, looks good, I will update it.

// Robert

Sent from mobile phone

> 在 2019年3月4日,18:57,Burton, Ross <ross.burton@intel.com> 写道:
> 
>> On Mon, 4 Mar 2019 at 10:30, Robert Yang <liezhi.yang@windriver.com> wrote:
>> +    arg_parse.add_argument("--no-ssl",
>> +                           help="Use http instead of https protocol",
>> +                           action="store_true")
> 
> If you do this instead:
> 
> arg_parse.add_argument("--no-ssl", help="Use http instead of https protocol",
>      dest="protocol", action="store_const", const="http", default="https")
> 
> Then you can just use args.protocol instead of having to pass around
> the protocol name.
> 
> Ross


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-04 11:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-04 10:48 [PATCH 0/1] send-error-report: Add --no-ssl to use http protocol Robert Yang
2019-03-04 10:49 ` [PATCH 1/1] " Robert Yang
2019-03-04 10:56   ` Burton, Ross
2019-03-04 11:43     ` Yang, Liezhi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox