Skip to contentSkip to conversation

report-error.bbclass: Add support for autosending

RFC PATCH In review Elizabeth 'pidge' Flanagan 5 participants 6 messages Sep 8, 2016 – Sep 9, 2016

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 report-error.bbclass: Add support for autosending

This commit pulls and extends the functionality of .oe-error-report into local.conf. It maintains the functionality of .oe-error-report.

It also enables report-error to automatically send error reports to a specified error report server. This patch enables infrastructure ppl to set development teams up so that we can gather error metrics automatically.

This relies on a new set of variables:

REPORTERROR[autosend]="yes|no|ask"
REPORTERROR[user]=username
REPORTERROR[email]=email
REPORTERROR[server]=error-report-web instance

For autosend yes and no are pretty self explainatory. ask does not pass the -y flag to send-error-report, thus enabling the end user to review the report prior to submission.

---
 meta/classes/report-error.bbclass | 41 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)
meta/classes/report-error.bbclass +39 -2
index 82b5bcd..909adf0 100644
@@ -85,10 +85,47 @@ python errorreport_handler () {
             bb.utils.unlockfile(lock)
             failures = jsondata['failures']
             if(len(failures) > 0):
+
                 filename = "error_report_" + e.data.getVar("BUILDNAME", True)+".txt"
                 datafile = errorreport_savedata(e, jsondata, filename)
-                bb.note("The errors for this build are stored in %s\nYou can send the errors to a reports server by running:\n  send-error-report %s [-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. Please ensure you remove any identifying or proprietary information when prompted before sending.")
+
+                cmd_s = "send-error-report %s" % datafile
+                response_s = "The errors for this build are stored in %s\n" % datafile
+                sendit = False
+
+                autosend = e.data.getVarFlag("REPORTERROR","autosend")
+                user = e.data.getVarFlag("REPORTERROR","user")
+                email = e.data.getVarFlag("REPORTERROR","email")
+                server = e.data.getVarFlag("REPORTERROR","server")
+
+                if user is not None:
+                    cmd_s += " -n %s" % user
+                if email is not None:
+                    cmd_s += " -e %s" % email
+                if server is not None:
+                    cmd_s += " -s %s" % server
+
+                if autosend is not None:
+                    if autosend == "yes":
+                        response_s += "The errors for this build are set to automatically be sent.\n"
+                        cmd_s += " -y"
+                        sendit = True
+                    elif autosend == "ask":
+                        response_s += "The errors for this build are set to automatically be sent.\n"
+                        sendit = True
+                elif autosend is None:
+                        response_s += "You can send the errors to a reports server by running:\n  %s\n" % cmd_s
+                elif e.data.getVarFlags('REPORTERROR') is None:
+                        response_s += "You can send the errors to a reports server by running:\n  %s [-s server]\n" % cmd_s
+                        response_s += "The contents of these logs will be posted in public if you use the above command with the default server.\n \
+                             Please ensure you remove any identifying or proprietary information when prompted before sending.\n"
+
+                bb.note(response_s)
+
+                if sendit == True:
+                    import shlex, subprocess
+                    args = shlex.split(cmd_s)
+                    subprocess.call(args)
 }
 
 addhandler errorreport_handler
Signature · 1 line
2.9.3
#1 lore raw
Quoted 54 lines · Elizabeth 'pidge' Flanagan

This commit pulls and extends the functionality of .oe-error-report into local.conf. It maintains the functionality of .oe-error-report.

It also enables report-error to automatically send error reports to a specified error report server. This patch enables infrastructure ppl to set development teams up so that we can gather error metrics automatically.

This relies on a new set of variables:

REPORTERROR[autosend]="yes|no|ask"
REPORTERROR[user]=username
REPORTERROR[email]=email
REPORTERROR[server]=error-report-web instance

For autosend yes and no are pretty self explainatory. ask does not pass the -y flag to send-error-report, thus enabling the end user to review the report prior to submission.

---
 meta/classes/report-error.bbclass | 41 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)
meta/classes/report-error.bbclass +19 -2
index 82b5bcd..909adf0 100644
@@ -85,10 +85,47 @@ python errorreport_handler () {
             bb.utils.unlockfile(lock)
             failures = jsondata['failures']
             if(len(failures) > 0):
+
                 filename = "error_report_" + e.data.getVar("BUILDNAME", True)+".txt"
                 datafile = errorreport_savedata(e, jsondata, filename)
-                bb.note("The errors for this build are stored in %s\nYou can send the errors to a reports server by running:\n  send-error-report %s [-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. Please ensure you remove any identifying or proprietary information when prompted before sending.")
+
+                cmd_s = "send-error-report %s" % datafile
+                response_s = "The errors for this build are stored in %s\n" % datafile
+                sendit = False
+
+                autosend = e.data.getVarFlag("REPORTERROR","autosend")
+                user = e.data.getVarFlag("REPORTERROR","user")
+                email = e.data.getVarFlag("REPORTERROR","email")
+                server = e.data.getVarFlag("REPORTERROR","server")
+
+                if user is not None:
+                    cmd_s += " -n %s" % user
+                if email is not None:
+                    cmd_s += " -e %s" % email
+                if server is not None:
+                    cmd_s += " -s %s" % server
+
+                if autosend is not None:

meta/classes/report-error.bbclass python errorreport_handler () { · line 118

Quoted 10 lines
meta/classes/report-error.bbclass +10 -0
+                    if autosend == "yes":
+                        response_s += "The errors for this build are set to automatically be sent.\n"
+                        cmd_s += " -y"
+                        sendit = True
+                    elif autosend == "ask":
+                        response_s += "The errors for this build are set to automatically be sent.\n"
+                        sendit = True
+                elif autosend is None:
+                        response_s += "You can send the errors to a reports server by running:\n  %s\n" % cmd_s
+                elif e.data.getVarFlags('REPORTERROR') is None:

The last elif will never be executed.

Quoted 14 lines
meta/classes/report-error.bbclass +10 -0
+                        response_s += "You can send the errors to a reports server by running:\n  %s [-s server]\n" % cmd_s
+                        response_s += "The contents of these logs will be posted in public if you use the above command with the default server.\n \
+                             Please ensure you remove any identifying or proprietary information when prompted before sending.\n"
+
+                bb.note(response_s)
+
+                if sendit == True:
+                    import shlex, subprocess
+                    args = shlex.split(cmd_s)
+                    subprocess.call(args)
 }
 
 addhandler errorreport_handler
#2 lore raw
In reply to Elizabeth 'pidge' Flanagan

Hey Beth,

Quoted 9 lines · On Thu, 08 Sep 2016 11:26:01 Elizabeth 'pidge' Flanagan wrote:

This commit pulls and extends the functionality of .oe-error-report into local.conf. It maintains the functionality of .oe-error-report.

It also enables report-error to automatically send error reports to a specified error report server. This patch enables infrastructure ppl to set development teams up so that we can gather error metrics automatically.

This relies on a new set of variables:

Quoted 8 lines

REPORTERROR[autosend]="yes|no|ask"
REPORTERROR[user]=username
REPORTERROR[email]=email
REPORTERROR[server]=error-report-web instance

For autosend yes and no are pretty self explainatory. ask does not pass the -y flag to send-error-report, thus enabling the end user to review the report prior to submission.

I'm not sure if sentiment has changed on this issue (FWIW, it hasn't really on my part), but this topic did come up before - start of thread here:

http://lists.openembedded.org/pipermail/openembedded-core/2014-March/090621.html

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#3 lore raw
Quoted 27 lines · Paul Eggleton

Hey Beth,

Quoted 19 lines · On Thu, 08 Sep 2016 11:26:01 Elizabeth 'pidge' Flanagan wrote:

This commit pulls and extends the functionality of .oe-error-report into
local.conf. It maintains the functionality of .oe-error-report.

It also enables report-error to automatically send error reports to a
specified error report server. This patch enables infrastructure ppl to
set development teams up so that we can gather error metrics automatically.

This relies on a new set of variables:

REPORTERROR[autosend]="yes|no|ask"
REPORTERROR[user]=username
REPORTERROR[email]=email
REPORTERROR[server]=error-report-web instance

Quoted 5 lines

For autosend yes and no are pretty self explainatory. ask does not pass
the -y flag to send-error-report, thus enabling the end user to review
the report prior to submission.

Quoted 7 lines

I'm not sure if sentiment has changed on this issue (FWIW, it hasn't really
on my part), but this topic did come up before - start of thread here:

http://lists.openembedded.org/pipermail/openembedded-core/2014-March/
090621.html

Thanks for digging that up. I am conscious that this was deliberately designed so the user has to sign up for auto submission. To do otherwise lets layers "spy" on users far too easily.

That said there are 101 ways you could do that anyway, this just makes it very very easy.

So I'm torn on this issue. How easy should auto-error submission be, given the information that could accidentally expose?

Cheers,

Richard

#4 lore raw
In reply to Elizabeth 'pidge' Flanagan
Quoted 9 lines · Elizabeth 'pidge' Flanagan

This commit pulls and extends the functionality of .oe-error-report into local.conf. It maintains the functionality of .oe-error-report.

It also enables report-error to automatically send error reports to a specified error report server. This patch enables infrastructure ppl to set development teams up so that we can gather error metrics automatically.

This relies on a new set of variables:

Quoted 8 lines

REPORTERROR[autosend]="yes|no|ask"
REPORTERROR[user]=username
REPORTERROR[email]=email
REPORTERROR[server]=error-report-web instance

For autosend yes and no are pretty self explainatory. ask does not pass the -y flag to send-error-report, thus enabling the end user to review the report prior to submission.

The same functionality was sent more than 2 years ago, but it was rejected, so I'm carrying it in our own fork since then:

http://lists.openembedded.org/pipermail/openembedded-core/2014-March/091222.html

Quoted 67 lines
---
 meta/classes/report-error.bbclass | 41 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)
meta/classes/report-error.bbclass +39 -2
index 82b5bcd..909adf0 100644
@@ -85,10 +85,47 @@ python errorreport_handler () {
             bb.utils.unlockfile(lock)
             failures = jsondata['failures']
             if(len(failures) > 0):
+
                 filename = "error_report_" + e.data.getVar("BUILDNAME", True)+".txt"
                 datafile = errorreport_savedata(e, jsondata, filename)
-                bb.note("The errors for this build are stored in %s\nYou can send the errors to a reports server by running:\n  send-error-report %s [-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. Please ensure you remove any identifying or proprietary information when prompted before sending.")
+
+                cmd_s = "send-error-report %s" % datafile
+                response_s = "The errors for this build are stored in %s\n" % datafile
+                sendit = False
+
+                autosend = e.data.getVarFlag("REPORTERROR","autosend")
+                user = e.data.getVarFlag("REPORTERROR","user")
+                email = e.data.getVarFlag("REPORTERROR","email")
+                server = e.data.getVarFlag("REPORTERROR","server")
+
+                if user is not None:
+                    cmd_s += " -n %s" % user
+                if email is not None:
+                    cmd_s += " -e %s" % email
+                if server is not None:
+                    cmd_s += " -s %s" % server
+
+                if autosend is not None:
+                    if autosend == "yes":
+                        response_s += "The errors for this build are set to automatically be sent.\n"
+                        cmd_s += " -y"
+                        sendit = True
+                    elif autosend == "ask":
+                        response_s += "The errors for this build are set to automatically be sent.\n"
+                        sendit = True
+                elif autosend is None:
+                        response_s += "You can send the errors to a reports server by running:\n  %s\n" % cmd_s
+                elif e.data.getVarFlags('REPORTERROR') is None:
+                        response_s += "You can send the errors to a reports server by running:\n  %s [-s server]\n" % cmd_s
+                        response_s += "The contents of these logs will be posted in public if you use the above command with the default server.\n \
+                             Please ensure you remove any identifying or proprietary information when prompted before sending.\n"
+
+                bb.note(response_s)
+
+                if sendit == True:
+                    import shlex, subprocess
+                    args = shlex.split(cmd_s)
+                    subprocess.call(args)
 }
 
 addhandler errorreport_handler
Signature · 7 lines
2.9.3

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#5 lore raw
Quoted 26 lines · Martin Jansa
Quoted 19 lines · Elizabeth 'pidge' Flanagan

This commit pulls and extends the functionality of .oe-error-report into
local.conf. It maintains the functionality of .oe-error-report.

It also enables report-error to automatically send error reports to a
specified error report server. This patch enables infrastructure ppl to
set development teams up so that we can gather error metrics automatically.

This relies on a new set of variables:

REPORTERROR[autosend]="yes|no|ask"
REPORTERROR[user]=username
REPORTERROR[email]=email
REPORTERROR[server]=error-report-web instance

Quoted 5 lines

For autosend yes and no are pretty self explainatory. ask does not pass
the -y flag to send-error-report, thus enabling the end user to review
the report prior to submission.

Quoted 6 lines

The same functionality was sent more than 2 years ago, but it was rejected, so I'm carrying it in our own fork since then:

http://lists.openembedded.org/pipermail/openembedded-core/2014-March/
091222.html

I'd be happy to defer to that patch if we can pull this functionality in.

-b

Quoted 88 lines
Quoted 88 lines

---
 meta/classes/report-error.bbclass | 41
+++++++++++++++++++++++++++++++++++++--

 1 file changed, 39 insertions(+), 2 deletions(-)
meta/classes/report-error.bbclass +0 -0
index 82b5bcd..909adf0 100644
@@ -85,10 +85,47 @@ python errorreport_handler () {
              bb.utils.unlockfile(lock)

             failures = jsondata['failures'] if(len(failures) > 0):
+
                 filename = "error_report_" + e.data.getVar("BUILDNAME", True)+".txt"
                 datafile = errorreport_savedata(e, jsondata, filename)
-                bb.note("The errors for this build are stored in %s\nYou can send the errors to a reports server by running:\n  send-error-report %s [-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. Please ensure you remove any identifying or proprietary information when prompted before sending.")
+
+                cmd_s = "send-error-report %s" % datafile +                response_s = "The errors for this build are stored in %s\n" % datafile
+                sendit = False
+
+                autosend = e.data.getVarFlag("REPORTERROR","autosend")
+                user = e.data.getVarFlag("REPORTERROR","user") +                email = e.data.getVarFlag("REPORTERROR","email") +                server = e.data.getVarFlag("REPORTERROR","server")

meta/classes/report-error.bbclass +11 -0
+
+                if user is not None:
+                    cmd_s += " -n %s" % user
+                if email is not None:
+                    cmd_s += " -e %s" % email
+                if server is not None:
+                    cmd_s += " -s %s" % server
+
+                if autosend is not None:
+                    if autosend == "yes":
+                        response_s += "The errors for this build

are set to automatically be sent.\n"
+                        cmd_s += " -y"
+                        sendit = True
+                    elif autosend == "ask":
+                        response_s += "The errors for this build are set to automatically be sent.\n"
+                        sendit = True
+                elif autosend is None:
+                        response_s += "You can send the errors to a reports server by running:\n  %s\n" % cmd_s
+                elif e.data.getVarFlags('REPORTERROR') is None:
+                        response_s += "You can send the errors to a reports server by running:\n  %s [-s server]\n" % cmd_s +                        response_s += "The contents of these logs will be posted in public if you use the above command with the default server.\n \
+                             Please ensure you remove any identifying or proprietary information when prompted before sending.\n"

meta/classes/report-error.bbclass +7 -0
+
+                bb.note(response_s)
+
+                if sendit == True:
+                    import shlex, subprocess
+                    args = shlex.split(cmd_s)
+                    subprocess.call(args)

 }

 addhandler errorreport_handler
--
2.9.3

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core