All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] reporter-error sending report
@ 2014-11-12 23:08 João Henrique Ferreira de Freitas
  2014-11-12 23:08 ` [PATCH 1/2] report-error: sending error report to server without user intervention João Henrique Ferreira de Freitas
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: João Henrique Ferreira de Freitas @ 2014-11-12 23:08 UTC (permalink / raw)
  To: openembedded-core

When the Error Reporting Tool is enabled and the build fails, then the report-error 
prints an url that the user needs to get and use the send-error-report tool which
will sends the reporter to a public or private reporting server error.

This works very well if the user is sitting in front of the building machine.
There are some cases, like jobs running on Jenkins server, that need to send
reports automatically when a build fails.

This patch set introduces a glue between reporter-error.bbclass and send-error-reporter tool.
So, report erros will be send as soon as an error happens.

Two new variables were added and the user takes the responsible to fill them (conf/site.conf),
for example:

INHERIT += "report-error"
ERR_REPORT_SERVER = "127.0.0.1:8000"
ERR_REPORT_USER = "joaohf"
ERR_REPORT_EMAIL = "joaohf@gmail.com"


João Henrique Ferreira de Freitas (2):
  report-error: sending error report to server without user intervention
  report-error: send report error with username and email

 meta/classes/report-error.bbclass | 15 +++++++++++++
 scripts/send-error-report         | 45 ++++++++++++++++++++++++---------------
 2 files changed, 43 insertions(+), 17 deletions(-)

-- 
1.9.1



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

* [PATCH 1/2] report-error: sending error report to server without user intervention
  2014-11-12 23:08 [PATCH 0/2] reporter-error sending report João Henrique Ferreira de Freitas
@ 2014-11-12 23:08 ` João Henrique Ferreira de Freitas
  2014-11-12 23:08 ` [PATCH 2/2] report-error: send report error with username and email João Henrique Ferreira de Freitas
  2014-11-13 12:58 ` [PATCH 0/2] reporter-error sending report Martin Jansa
  2 siblings, 0 replies; 4+ messages in thread
From: João Henrique Ferreira de Freitas @ 2014-11-12 23:08 UTC (permalink / raw)
  To: openembedded-core

If ERR_REPORT_SERVER is set to a server which has a running instance of
Error Reporting Tool, then that server will be used to send error
reports.

Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
---
 meta/classes/report-error.bbclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 5fe2355..f9e821f 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -7,6 +7,7 @@
 # Licensed under the MIT license, see COPYING.MIT for details
 
 ERR_REPORT_DIR ?= "${LOG_DIR}/error-report"
+ERR_REPORT_SERVER ?= ""
 
 def errorreport_getdata(e):
     logpath = e.data.getVar('ERR_REPORT_DIR', True)
@@ -24,6 +25,16 @@ def errorreport_savedata(e, newdata, file):
         json.dump(newdata, f, indent=4, sort_keys=True)
     return datafile
 
+def errorreport_senddata(e, datafile):
+    import subprocess
+    server = e.data.getVar('ERR_REPORT_SERVER', True)
+    if server:
+        cmd = 'send-error-report %s %s' % (datafile, server)
+        subprocess.call(cmd, shell=True)
+    else:
+        bb.note("The errors for this build are stored in %s\nYou can send the errors to an upstream server by running:\n  send-error-report %s [server]" % (datafile, datafile))
+        bb.note("The contents of these logs will be posted in public if you use the above command with the default server. If you need to do so, please ensure you remove any identifying or proprietary information before sending.")
+    
 python errorreport_handler () {
         import json
 
-- 
1.9.1



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

* [PATCH 2/2] report-error: send report error with username and email
  2014-11-12 23:08 [PATCH 0/2] reporter-error sending report João Henrique Ferreira de Freitas
  2014-11-12 23:08 ` [PATCH 1/2] report-error: sending error report to server without user intervention João Henrique Ferreira de Freitas
@ 2014-11-12 23:08 ` João Henrique Ferreira de Freitas
  2014-11-13 12:58 ` [PATCH 0/2] reporter-error sending report Martin Jansa
  2 siblings, 0 replies; 4+ messages in thread
From: João Henrique Ferreira de Freitas @ 2014-11-12 23:08 UTC (permalink / raw)
  To: openembedded-core

Two variables ERR_REPORT_USER and ERR_REPORT_EMAIL were created
to instruct send-report-error to use 'user' and 'email' from command
line parameters instead of checking '~/.oe-send-error' file.

Two new positional arguments were added to send-report-error.
If 'username' (third argument) is passed, then send-error-report will
not check userfile. As 'email' (forth argument) is an optional,
it will used only if passed.

Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
---
 meta/classes/report-error.bbclass |  6 +++++-
 scripts/send-error-report         | 45 ++++++++++++++++++++++++---------------
 2 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index f9e821f..253a659 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -8,6 +8,8 @@
 
 ERR_REPORT_DIR ?= "${LOG_DIR}/error-report"
 ERR_REPORT_SERVER ?= ""
+ERR_REPORT_USER ?= ""
+ERR_REPORT_EMAIL ?= ""
 
 def errorreport_getdata(e):
     logpath = e.data.getVar('ERR_REPORT_DIR', True)
@@ -29,7 +31,9 @@ def errorreport_senddata(e, datafile):
     import subprocess
     server = e.data.getVar('ERR_REPORT_SERVER', True)
     if server:
-        cmd = 'send-error-report %s %s' % (datafile, server)
+        user = e.data.getVar('ERR_REPORT_USER', True)
+        email = e.data.getVar('ERR_REPORT_EMAIL', True)
+        cmd = 'send-error-report %s %s %s %s' % (datafile, server, user, email)
         subprocess.call(cmd, shell=True)
     else:
         bb.note("The errors for this build are stored in %s\nYou can send the errors to an upstream server by running:\n  send-error-report %s [server]" % (datafile, datafile))
diff --git a/scripts/send-error-report b/scripts/send-error-report
index c99d387..b5c4972 100755
--- a/scripts/send-error-report
+++ b/scripts/send-error-report
@@ -42,27 +42,35 @@ def handle_connection(server, data):
     return conn
 
 
-def sendData(json_file, server):
+def sendData(json_file, server, username = '', email = ''):
 
     if os.path.isfile(json_file):
 
-        home = os.path.expanduser("~")
-        userfile = os.path.join(home, ".oe-send-error")
-        if os.path.isfile(userfile):
-            with open(userfile) as g:
-                username = g.readline()
-                email = g.readline()
+        if username:
+            if len(username) > 0 and len(username) > 50:
+                print("Invalid username input, try again.")
+                return
+            if len(email) > 0 and len(email) > 50:
+                print("Invalid username input, try again.")
+                return
         else:
-            print("Please enter your name and your email (optionally), they'll be saved in the file you send.")
-            username = raw_input("Name: ")
-            email = raw_input("E-mail (not required): ")
-            if len(username) > 0 and len(username) < 50:
-                with open(userfile, "w") as g:
-                    g.write(username + "\n")
-                    g.write(email + "\n")
+            home = os.path.expanduser("~")
+            userfile = os.path.join(home, ".oe-send-error")
+            if os.path.isfile(userfile):
+                with open(userfile) as g:
+                    username = g.readline()
+                    email = g.readline()
             else:
-                print("Invalid inputs, try again.")
-                return
+                print("Please enter your name and your email (optionally), they'll be saved in the file you send.")
+                username = raw_input("Name: ")
+                email = raw_input("E-mail (not required): ")
+                if len(username) > 0 and len(username) < 50:
+                    with open(userfile, "w") as g:
+                        g.write(username + "\n")
+                        g.write(email + "\n")
+                else:
+                    print("Invalid inputs, try again.")
+                    return
 
         with open(json_file) as f:
             data = f.read()
@@ -103,8 +111,11 @@ if __name__ == '__main__':
         print("\nUsage: send-error-report <error_fileName> [server]")
         print("\nIf this is the first when sending a report you'll be asked for your name and optionally your email address.")
         print("They will be associated with your report.\n")
-
     elif len(sys.argv) == 3:
         sendData(sys.argv[1], sys.argv[2])
+    elif len(sys.argv) == 4:
+        sendData(sys.argv[1], sys.argv[2], sys.argv[3])
+    elif len(sys.argv) == 5:
+        sendData(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
     else:
         sendData(sys.argv[1], "errors.yoctoproject.org")
-- 
1.9.1



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

* Re: [PATCH 0/2] reporter-error sending report
  2014-11-12 23:08 [PATCH 0/2] reporter-error sending report João Henrique Ferreira de Freitas
  2014-11-12 23:08 ` [PATCH 1/2] report-error: sending error report to server without user intervention João Henrique Ferreira de Freitas
  2014-11-12 23:08 ` [PATCH 2/2] report-error: send report error with username and email João Henrique Ferreira de Freitas
@ 2014-11-13 12:58 ` Martin Jansa
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Jansa @ 2014-11-13 12:58 UTC (permalink / raw)
  To: João Henrique Ferreira de Freitas; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1948 bytes --]

On Wed, Nov 12, 2014 at 09:08:37PM -0200, João Henrique Ferreira de Freitas wrote:
> When the Error Reporting Tool is enabled and the build fails, then the report-error 
> prints an url that the user needs to get and use the send-error-report tool which
> will sends the reporter to a public or private reporting server error.
> 
> This works very well if the user is sitting in front of the building machine.
> There are some cases, like jobs running on Jenkins server, that need to send
> reports automatically when a build fails.
> 
> This patch set introduces a glue between reporter-error.bbclass and send-error-reporter tool.

it's report-error.bbclass and send-error-report (not reporter)

> So, report erros will be send as soon as an error happens.
> 
> Two new variables were added and the user takes the responsible to fill them (conf/site.conf),
> for example:
> 
> INHERIT += "report-error"
> ERR_REPORT_SERVER = "127.0.0.1:8000"
> ERR_REPORT_USER = "joaohf"
> ERR_REPORT_EMAIL = "joaohf@gmail.com"

See
http://lists.openembedded.org/pipermail/openembedded-core/2014-March/090576.html
which does the same, but was rejected because of concerns that someone
will unintentionally upload sensitive data to some public report server.

> 
> 
> João Henrique Ferreira de Freitas (2):
>   report-error: sending error report to server without user intervention
>   report-error: send report error with username and email
> 
>  meta/classes/report-error.bbclass | 15 +++++++++++++
>  scripts/send-error-report         | 45 ++++++++++++++++++++++++---------------
>  2 files changed, 43 insertions(+), 17 deletions(-)
> 
> -- 
> 1.9.1
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 188 bytes --]

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

end of thread, other threads:[~2014-11-13 12:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-12 23:08 [PATCH 0/2] reporter-error sending report João Henrique Ferreira de Freitas
2014-11-12 23:08 ` [PATCH 1/2] report-error: sending error report to server without user intervention João Henrique Ferreira de Freitas
2014-11-12 23:08 ` [PATCH 2/2] report-error: send report error with username and email João Henrique Ferreira de Freitas
2014-11-13 12:58 ` [PATCH 0/2] reporter-error sending report Martin Jansa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.