Closed Bug 778177 Opened 13 years ago Closed 13 years ago

add a watcher.ini file to the tegras while we roll out sutagent 1.11

Categories

(Release Engineering :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jmaher, Assigned: Callek)

Details

Attachments

(3 files, 2 obsolete files)

Here is some code that will add a watcher.ini to the tegras. This will allow it to ping bm-remote instead of mozilla.org: import devicemanagerSUT destname = '/data/data/com.mozilla.watcher/files/watcher.ini' tmpname = '/mnt/sdcard/watcher.ini' data = '\r\n[watcher]\r\nPingTarget = bm-remote.build.mozilla.org\r\n' dm = devicemanagerSUT.DeviceManagerSUT('192.168.1.69', 20701) dm.verifySendCMD(['push %s %s\r\n' % (tmpname, len(data)), data], newline = False) dm.sendCMD(['exec su -c "dd if=%s of=%s"' % (tmpname, destname)])
No longer depends on: 778161
Attached patch [tools] v1Splinter Review
Based on Joel's patch. The idea is I can do: for i in tegra-*; do PYTHONPATH=/builds/sut_tools python sut_tools/update_watcher_ini.py $i; done and be done a whole foopy.
Assignee: nobody → bugspam.Callek
Status: NEW → ASSIGNED
Attachment #646617 - Flags: review?(coop)
Attachment #646617 - Flags: feedback?(jmaher)
Comment on attachment 646617 [details] [diff] [review] [tools] v1 Review of attachment 646617 [details] [diff] [review]: ----------------------------------------------------------------- just remember this is pegged to the devicemanager that we use in sut_tools :)
Attachment #646617 - Flags: feedback?(jmaher) → feedback+
Comment on attachment 646617 [details] [diff] [review] [tools] v1 Review of attachment 646617 [details] [diff] [review]: ----------------------------------------------------------------- ::: sut_tools/update_watcher_ini.py @@ +1,5 @@ > +#!/usr/bin/env python > + > +def main(tegra): > + import devicemanagerSUT > + destname = '/data/data/com.mozilla.watcher/files/watcher.ini' /data/data is the correct dir here, and not an accidental duplication?
Attachment #646617 - Flags: review?(coop) → review+
yes, /data/data is legit on android. Thanks for asking.
Ok this is now done for all tegras on linux-foopy-test, foopy05 and foopy06; deploying is annoying given the normal reboots, so we'll get this tied to verify somehow for real deploy.
so we want strikes=0 to be added as well. this line: + data = '\r\n[watcher]\r\nPingTarget = bm-remote.build.mozilla.org\r\n' should be: + data = '\r\n[watcher]\r\nPingTarget = bm-remote.build.mozilla.org\r\nstrikes = 0\r\n'
Attached patch Part 2 (obsolete) — Splinter Review
This obsoletes the v1 patch here, and should make it deployed into prod easily.
Attachment #647773 - Flags: review?(jmaher)
Attachment #647773 - Flags: review?(armenzg)
Comment on attachment 647773 [details] [diff] [review] Part 2 Review of attachment 647773 [details] [diff] [review]: ----------------------------------------------------------------- ::: sut_tools/verify.py @@ +212,5 @@ > + if not dmAlive(dm): > + return False > + > + realLoc = "/data/data/com.mozilla.watcher/files/watcher.ini" > + if dm.fileExists(realLoc): this doesn't check the value of the file, just that it exists. @@ +219,5 @@ > + try: > + tmpname = '/mnt/sdcard/watcher.ini' > + # Need to install it > + dm.verifySendCMD(['push %s %s\r\n' % (tmpname, len(watcherINI)), watcherINI], newline = False) > + dm.sendCMD(['exec su -c "dd if=%s of=%s"' % (tmpname, destname)]) s/destname/realLoc/ @@ +222,5 @@ > + dm.verifySendCMD(['push %s %s\r\n' % (tmpname, len(watcherINI)), watcherINI], newline = False) > + dm.sendCMD(['exec su -c "dd if=%s of=%s"' % (tmpname, destname)]) > + except: > + setFlag(errorFile, "Unable to properly upload the watcher.ini") > + return False you don't return True on success.
Attachment #647773 - Flags: review?(jmaher) → review-
(In reply to Joel Maher (:jmaher) from comment #8) > Comment on attachment 647773 [details] [diff] [review] > Part 2 > > Review of attachment 647773 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: sut_tools/verify.py > @@ +212,5 @@ > > + if not dmAlive(dm): > > + return False > > + > > + realLoc = "/data/data/com.mozilla.watcher/files/watcher.ini" > > + if dm.fileExists(realLoc): > > this doesn't check the value of the file, just that it exists. O right :( I lost your pastebin on that check, can you remind me the magic? > s/destname/realLoc/ Good catch -- also a good sign that my mind is mushing now, and that I should not do deploy tonight, as sanity > you don't return True on success. Fixed
Attachment #647773 - Flags: review?(armenzg)
Attached patch Part 2.1 (obsolete) — Splinter Review
This actually works on staging, not sure what was different between line endings before but this solved it.
Attachment #647773 - Attachment is obsolete: true
Attachment #648223 - Flags: review?(jmaher)
Attachment #648223 - Flags: review?(armenzg)
Comment on attachment 648223 [details] [diff] [review] Part 2.1 Review of attachment 648223 [details] [diff] [review]: ----------------------------------------------------------------- the \r\n is tricky, a relic from the windows mobile days. When we had both agents in the works, our scripts had to account for \r\n and so we made the android version hack it in as well. The two comments below are nothing of concern, just nits or general questions. ::: sut_tools/verify.py @@ +224,5 @@ > + return True > + except: > + setFlag(errorFile, "Unable to identify if watcher.ini is current") > + raise > + return False I think the return False will never get hit @@ +276,5 @@ > if not cleanupTegra(dm): > return False > + > + if not setWatcherINI(dm): > + return False you don't catch the exception that is raised here. Do you want a big old traceback printed to the tinderbox log or catch it and handle it with a known error?
Attachment #648223 - Flags: review?(jmaher) → review+
So, this removes the superfluous raise that I had in here (which was for testing an earlier issue) and makes the final failure more meaningful and useful in all failures there.
Attachment #648223 - Attachment is obsolete: true
Attachment #648223 - Flags: review?(armenzg)
Attachment #648374 - Flags: review?(armenzg)
Comment on attachment 648374 [details] [diff] [review] [tools] Part 2 -- Final Review of attachment 648374 [details] [diff] [review]: ----------------------------------------------------------------- r+ with addressing my comment one way (put it in a function) or the other (there is a slight difference that you missed). Good job Callek! ::: sut_tools/verify.py @@ +241,5 @@ > + return True > + except: > + pass > + setFlag(errorFile, "Unable to verify the updated watcher.ini") > + return False This try/except block is pretty much the same as the previous one (unless I'm missing something). This could be a call to a function to make it cleaner and reduce the chances to modify one and not the other in the future. Unless I got it wrong, would you please put it in a function?
Attachment #648374 - Flags: review?(armenzg) → review+
(In reply to [:armenzg] - gone from Aug. 3rd to Aug. 27th from comment #13) > Comment on attachment 648374 [details] [diff] [review] > [tools] Part 2 -- Final > > Review of attachment 648374 [details] [diff] [review]: > ----------------------------------------------------------------- > > r+ with addressing my comment one way (put it in a function) or the other > (there is a slight difference that you missed). > > Good job Callek! Allow me to give at least half the "Good Job" credit to joel, for he was the one that came up with the dm.* commands to do this, and the .ini options. Even though I fully support the change. That said, me and armen spoke in person about this, and determined that as-is is better than trying to abstract any more of it into a function. http://hg.mozilla.org/build/tools/rev/bcc3a7523513 (reso/fixed, but not yet deployed)
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Apparently Part 2 tested fine in staging, but busted in prod -- this was tested in prod and worked fine.
Attachment #648850 - Flags: review?(jmaher)
Attachment #648850 - Flags: review?(coop)
Comment on attachment 648850 [details] [diff] [review] [tools] Part 2's bustage fix Review of attachment 648850 [details] [diff] [review]: ----------------------------------------------------------------- logically this looks just fine. I am really confused with staging/production are so different.
Attachment #648850 - Flags: review?(jmaher) → review+
Attachment #648850 - Flags: review?(coop) → review+
Product: mozilla.org → Release Engineering
Component: General Automation → General
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: