Closed Bug 920010 Opened 11 years ago Closed 11 years ago

update talos to print accurate links to datazilla

Categories

(Testing :: Talos, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jmaher, Assigned: jmaher)

References

Details

Attachments

(1 file)

Currently we print links to tbpl which point to the old Jolly Green Giant UI which is not valid anymore.  It is time to update this!
Assignee: nobody → jmaher
Status: NEW → ASSIGNED
Attachment #816570 - Flags: review?(jhammel)
Comment on attachment 816570 [details] [diff] [review]
print links to the new datazilla ui from talos->tbpl (1.0)

Review of attachment 816570 [details] [diff] [review]:
-----------------------------------------------------------------

Please fix the noted issues.  Otherwise, looks fine with the fixes

::: talos/output.py
@@ +11,4 @@
>  import post_file
>  import tempfile
>  import time
> +import datetime

nit: not in alphabetical order; if intended, fine.

@@ +508,4 @@
>  
>          # submit the request
>          req = DatazillaRequest.create(scheme, server, project, oauth_key, oauth_secret, results)
> +#        responses = req.submit()

delete or explain comment, please

@@ +521,4 @@
>              else:
>                  res = response.read()
>                  print "Datazilla response is: %s" % res.lower()
> +        """

as above: please delete or explain

@@ +525,5 @@
>          # TBPL output
>          # URLs are in the form of
> +        # https://datazilla.mozilla.org/?start=1379423909&stop=1380028709&product=Firefox&repository=Mozilla-Inbound&os=linux&os_version=Ubuntu%2012.04&test=a11yr&x86=false&project=talos
> +#        if results.branch and results.revision:
> +        if 1 == 1:

Pls fix

@@ +527,5 @@
> +        # https://datazilla.mozilla.org/?start=1379423909&stop=1380028709&product=Firefox&repository=Mozilla-Inbound&os=linux&os_version=Ubuntu%2012.04&test=a11yr&x86=false&project=talos
> +#        if results.branch and results.revision:
> +        if 1 == 1:
> +            # compute url
> +            now = "%s" % datetime.datetime.now()

i usually do e.g. str(datetime.datetime.now()) if it is necesssary to immediately cast -> str , but this is fine too if there is a reason where strftime doesn't work.

@@ +542,5 @@
> +            if results.revision and results.revision != 'NULL':
> +                revision = "&graph_search=%s" % results.revision
> +
> +            query = "start=%s&stop=%s&product=%s&repository=%s&os=%s&os_version=%s&project=%s%s%s" % (jsstart, jsend, results.build_name, results.branch, results.os.lower(), urllib.quote(results.os_version), project, revision, arch)
> +

You don't want to build a query string like this.  use urllib.urlencode (which I believe also quotes for you):

>>> urllib.urlencode(dict(foo='bar', fleem='m&ary'))
'fleem=m%26ary&foo=bar'
Attachment #816570 - Flags: review?(jhammel) → review+
the problem I have with urlencode is that it turns "Ubuntu 12.04" -> "Ubuntu+12.04" instead of "Ubunut%2012.04".  This appears to be a bug in urllib.

the other things are easy to clean up, my bad for a sloppy patch.  Please advice on the url construction.
Flags: needinfo?(jhammel)
(In reply to Joel Maher (:jmaher) from comment #4)
> the problem I have with urlencode is that it turns "Ubuntu 12.04" ->
> "Ubuntu+12.04" instead of "Ubunut%2012.04".  This appears to be a bug in
> urllib.
> 
> the other things are easy to clean up, my bad for a sloppy patch.  Please
> advice on the url construction.

To give quick feedback, I would advise for expediency to in this case not use urlencode but it would be nice to at least make this more programmatic.  E.g. 

query = {}
query['foo'] = 'Ubuntu 12.04'
querystring = '?%s' % '&'.join(['%s=%s' % (key, urllib.urlquote(value)) for key, value in query.items()])
Flags: needinfo?(jhammel)
Depends on: 928370
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: