Closed Bug 891318 Opened 11 years ago Closed 9 years ago

hg.m.o user clone script finds nonlive (and some perm denied dirs)

Categories

(Developer Services :: Mercurial: hg.mozilla.org, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Callek, Unassigned)

References

Details

(Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1064] )

So doing |ssh hg.mozilla.org clone foo| and then selecting to clone a public repo finds the following:

467) nonlive/birch-broken.
468) nonlive/ash-reset-718794.
469) /usr/bin/find: `nonlive/birch-wut': Permission denied.
470) nonlive/ux_backup.
471) nonlive/ux-backup-816300.
472) nonlive/try-778062-2.
473) nonlive/try-broken-2013-05-14.
474) nonlive/try-broken-2013-05-30.
475) .


specifically 475 and 469 look really bad, but all of them should probably be ignored.
Group: mozilla-corporation-confidential
Component: WebOps: IT-Managed Tools → WebOps: Source Control
I've moved the nonlive directory up a level (/repo/hg) so that it's no longer found. The 475 entry looks like an artifact of the sh_helper.py script; will try to sort that out unless :bkero has a quick fix (python's not my strong suit).
Looks like Popen()'s got a trailing '\n' which is getting split into it's own list element, and thus shows up as as line 475 above.  I believe the solution is:

*** hg_helper.py	2012-04-30 13:19:44.969924507 -0700
--- hg_helper-new.py	2013-07-09 08:42:26.463930495 -0700
***************
*** 152,157 ****
--- 152,158 ----
            print "We have the repo_list"
            repo_list = map (lambda x: x.replace (doc_root[cname] + '/', ''), repo_list)
            repo_list = map (lambda x: x.replace ('/.hg', ''), repo_list)
+           repo_list = filter (None, repo_list)
            print 'List of available public repos'
            source_repo = prompt_user ('Pick a source repo:', repo_list)
        elif (selection == 'Clone a private repository'):


but I defer to someone with more python experience.
I would not user filter here, as it may be confusing. Instead, maybe loop over the lines in repo_list and create new list and only add the lines you want to it. For example:

final_repo_list = []

for repo in repo_list:
    if repo == ".":
        continue
    else:
        final_repo_list.append(repo)

If you need to ignore more things just add extra elif lines.

If you want to keep the filter, I would suggest creating a new function that knows when to return True/False and pass that to filter (instead of None). For example:

def good_repo(repo):
    if repo == ".":
        return False
    else:
        return True

repo_list = filter(good_repo, repo_list)

Either of these approaches will work.

P.S. For docs on how the filter function works checkout `python -c "help(filter)"`
Group: mozilla-employee-confidential
Component: WebOps: Source Control → Mercurial: hg.mozilla.org
Product: Infrastructure & Operations → Developer Services
Whiteboard: [kanban:engops:https://kanbanize.com/ctrl_board/6/89]
Whiteboard: [kanban:engops:https://kanbanize.com/ctrl_board/6/89] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1053] [kanban:engops:https://kanbanize.com/ctrl_board/6/89]
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1053] [kanban:engops:https://kanbanize.com/ctrl_board/6/89] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1062] [kanban:engops:https://kanbanize.com/ctrl_board/6/89]
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1062] [kanban:engops:https://kanbanize.com/ctrl_board/6/89] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1064] [kanban:engops:https://kanbanize.com/ctrl_board/6/89]
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1064] [kanban:engops:https://kanbanize.com/ctrl_board/6/89] → [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/1064]
The trailing periods were removed a while ago. Ditto for "nonlive."

I just fixed empty entries and the permission denied messages.

The change is deployed to production.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.