Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 265008 - =www-client/pybugz 0.7.3 (enhancement request) run as cron
Summary: =www-client/pybugz 0.7.3 (enhancement request) run as cron
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High enhancement
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-05 19:24 UTC by David Abbott (RETIRED)
Modified: 2009-04-07 20:03 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Abbott (RETIRED) gentoo-dev 2009-04-05 19:24:53 UTC
I put together a little Python program [0][1] to email bugs assigned to bug wranglers and it works fine from the command line. When I try to run it from a cron it is looking for /bin/stty to determine the column's and row's. I will paste the error below.
[0] http://linuxcrazy.pastebin.com/f29276362
[1] http://linuxcrazy.pastebin.com/f5f84c6c7

Reproducible: Always




Traceback (most recent call last):
  File "/usr/bin/bugz", line 4, in <module>
    bugz.main()
  File "/usr/lib64/python2.5/site-packages/bugz.py", line 1761, in main
    bugz = PrettyBugz(**bugz_kwds)
  File "/usr/lib64/python2.5/site-packages/bugz.py", line 1199, in __init__
    self.columns = columns or get_cols()
  File "/usr/lib64/python2.5/site-packages/bugz.py", line 321, in get_cols
    rows, cols = map(int, row_cols.split())
ValueError: invalid literal for int() with base 10: '/bin/stty:'
Comment 1 David Abbott (RETIRED) gentoo-dev 2009-04-05 19:31:45 UTC
Here is the program, forgot and left my password in it.
http://linuxcrazy.pastebin.com/f37cba8ee
Comment 2 SpanKY gentoo-dev 2009-04-06 05:13:57 UTC
do not post links to external sites (*especially* ones like pastebin)

post *all* information into your report
Comment 3 David Abbott (RETIRED) gentoo-dev 2009-04-06 08:45:29 UTC
OK, Here is the program;

#!/usr/bin/python
# Filename: bug_wrangler.py

from subprocess import call
import smtplib, sys, MimeWriter, StringIO, base64
import os

def get_bugzs():
	searchbugz ='/usr/bin/searchbugz'
	call([searchbugz])

def mail(serverURL=None, port=None, sender='', to='', subject='', text=''):
	"""
	Usage:
	mail('smtp.gmail.com', 587, 'me@gmail.com', 'to@someone.com', 'Bug Wranglers', 'Current Bugs:')
	"""
	message = StringIO.StringIO()
	writer = MimeWriter.MimeWriter(message)
	writer.addheader('Subject', subject)
	writer.startmultipartbody('mixed')

	# start off with a text/plain part
	part = writer.nextpart()
	body = part.startbody('text/plain')
	body.write(text)

	# now add an attachment
	part = writer.nextpart()
	part.addheader('Content-Transfer-Encoding', 'base64')
	body = part.startbody('text/plain')
	base64.encode(open('/tmp/bugz.txt', 'rb'), body)

	# finish off
	writer.lastpart()

	# send the mail
	smtp = smtplib.SMTP('smtp.gmail.com', 587)
	smtp.ehlo()
	smtp.starttls()
	smtp.ehlo()
	smtp.login('me@gmail.com', 'passwd')
	smtp.sendmail(sender, to, message.getvalue())
	smtp.quit()

if __name__ == "__main__":
	get_bugzs()
	mail('smtp.gmail.com', 587, 'me@gmail.com','to@someone.com', 'Bug Wranglers', 'Current Bugs:')

Here is searchbugz;
#!/bin/bash
/usr/bin/bugz search -a bug-wranglers@gentoo.org > /tmp/bugz.txt

Here is the entry in /etc/cron.daily as getbugz;
#!/bin/bash
/usr/bin/bug_wrangler.py

Comment 4 William Hubbs gentoo-dev 2009-04-07 16:44:10 UTC
Hi David,

can you test this against pybugz-0.7.4_rc1 and let me know if itt has been fixed there?

Thanks,

William
Comment 5 David Abbott (RETIRED) gentoo-dev 2009-04-07 20:03:47 UTC
Hi William,
Now it is looking for a username:

david [03:22 PM] opteron ~ $ bugz search --assigned-to bug-wranglers@gentoo.org  > /tmp/bugz.txt
 * Using https://bugs.gentoo.org/ 
 * Searching for bugs with the following options:
 *    assigned_to          = bug-wranglers@gentoo.org
 * No username given.
Username:

I changed it to:

david [10:02 PM] opteron ~ $ cat /usr/bin/searchbugz 
#!/bin/bash
/usr/bin/bugz search -u david@linuxcrazy.com -p mypasswd -a bug-wranglers@gentoo.org > /tmp/bugz.txt

Thanks William,
Works Perfect, here is the mail;

Current Bugs:



 * Using https://bugs.gentoo.org/ 
 * Searching for bugs with the following options:
 *    assigned_to          = bug-wranglers@gentoo.org
 264412 bug-wranglers        app-text/pdftk-1.12 - gcjh Engine; Exception in th
 264417 bug-wranglers        cross-compiling dev-libs/icu-3.8.1-r1 fails
 264645 bug-wranglers        x11-base/xorg-server-1.4.2 - Xdmx: pointer stuck i
 264728 bug-wranglers        revdep-rebuild from app-portage/gentoolkit-0.2.4.2
 264755 bug-wranglers        crossdev: arm comes with thumb, but without interw
<snip>