Closed Bug 1042112 Opened 11 years ago Closed 11 years ago

[b2ghaystack] add ability to read arguments from file

Categories

(Testing :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: huseby, Assigned: sagarinocean, Mentored)

Details

(Whiteboard: [lang=py][good first bug])

Attachments

(1 file, 2 obsolete files)

45 bytes, text/x-github-pull-request
davehunt
: review+
Details | Review
currently, b2ghaystack requires you to type your password as a command line parameter. this is bad because your password goes into command history files. a more secure option is to put your password in a file that only you have read access to and then tell b2ghaystack to use the password in the file.
Julien: Is this something you might be interested in working on?
Mentor: dave.hunt
Flags: needinfo?(j.parkouss)
Whiteboard: [lang=py][good first bug]
I thought about this more. I'd prefer if we added support for a config file. The b2ghaystack script should first search the user's home directory, then the /etc directory for a config file that contains the username and passphrase. The command line switches for username and passphrase should override the config values. And, I want a command line switch for specifying a passphrase file. 0. Use command line username and passphrase switches. 1. If #0 doesn't exist, search for: $HOME/.b2ghaystack 2. If #1 doesn't exist, then search for: /etc/b2ghaystack.conf 3. Output error that username and passphrase must be specified.
Assigning sagar as requested ... sagar: you can post questions to the bug mentor in here now
Assignee: nobody → sagarinocean
Thank You Mark.Dave: How do you suggest I should get started with this ?
b2ghaystack uses argparse. It looks like this has a feature that can read arguments from a file, but is disabled by default. We could enable this and even add the file to the list of arguments if it exists. To work on this you would need to fork and clone the github repository at https://github.com/mozilla/b2ghaystack and the changes would likely go at the very start of the `cli` function: https://github.com/mozilla/b2ghaystack/blob/38eeb3b4200f660a9bbffd9cb5c5075e38627120/b2ghaystack/b2ghaystack.py#L131 Here's the argparse feature that allows reading arguments from file: https://docs.python.org/2/library/argparse.html#fromfile-prefix-chars Here's an example of automatically using a file if it exists: http://stackoverflow.com/a/7789081/154975 Dave: Would this meet your needs?
Flags: needinfo?(j.parkouss) → needinfo?(dhuseby)
Summary: [b2ghaystack] add ability to take a password file → [b2ghaystack] add ability to read arguments from file
Hi Dave, Sorry for the delay, I was in holidays this week. :) Apparently this bug is now assigned. Thank you for the proposal, I will take another one next time!
Flags: needinfo?(dhuseby)
Dave : Okay. I will get on it right away.
Dave : I have pushed the new edited code in my forked repo . What next ?
Hi sagar, I think you can create a pull request and add an attachment to this bug as described here: http://globau.wordpress.com/2013/10/21/github-pull-requests-and-bugzilla/. Don't forget to add Dave on the review field, with the "?" selected. Dave will then review your patches then merge the code. Hope this helps!
Attachment #8462956 - Flags: review?(dave.hunt)
Thanks a lot Julien . It was of great help .
Comment on attachment 8462956 [details] [review] Enable b2ghaystack to take password argument from file A good start, however the file can support more than just the password, so we should make that clear in the code. I included a couple of comments about code style, where we usually adhere to PEP 8. You might want to run your code through a pep8 checker before submitting your next patch. Unfortunately b2ghaystack currently requires access to our private builds, so it's difficult for you to test your changes. You should at least be able to run it until the authentication error though, which will allow you to test influencing the arguments by using a configuration file.
Attachment #8462956 - Flags: review?(dave.hunt) → review-
Thanks a lot Dave . I am on it.
Attached file Applied review suggestions . (obsolete) —
Attachment #8462956 - Attachment is obsolete: true
Attachment #8463344 - Flags: review?(dave.hunt)
Comment on attachment 8463344 [details] [review] Applied review suggestions . Check pull request for comments. Also, could you add a note to the README about the b2ghaystack.conf file?
Attachment #8463344 - Flags: review?(dave.hunt) → review-
Yes, Sure . I am on it .
Attached file Applied Second Review
Hopefully it will work just fine .
Attachment #8464854 - Flags: review?(dave.hunt)
Comment on attachment 8463344 [details] [review] Applied review suggestions . Don't forget to mark previous patches as obsolete, however if you're using the same github pull there's no need to attach a new patch. You can just flip the review flag from - to ?
Attachment #8463344 - Attachment is obsolete: true
Attachment #8464854 - Flags: review?(dave.hunt) → review-
Right Dave . I will definitely keep this in mind in future instances .
Attachment #8464854 - Flags: review- → review?(dave.hunt)
Attachment #8464854 - Flags: review?(dave.hunt) → review-
Attachment #8464854 - Flags: review- → review?(dave.hunt)
Comment on attachment 8464854 [details] [review] Applied Second Review This looks okay to me. Dave: could you confirm this works for you?
Attachment #8464854 - Flags: review?(dave.hunt) → review+
Flags: needinfo?(dhuseby)
Any instructions for me Dave ?
(In reply to Sagar Pandey from comment #21) > Any instructions for me Dave ? I'm just waiting on the reporter of this bug to confirm this addresses their request. Once this is confirmed I will go ahead and merge your patch. For now there's nothing for you to do. Thanks.
Alright , Thanks :)
I'm neck deep in some high priority privacy stuff and unable to test this out.
Flags: needinfo?(huseby)
Closing this as incomplete. The patch is fine, but I don't believe this tool is being used anymore.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INCOMPLETE
So , Is it now confirmed ? Working fine right ?
(In reply to Sagar Pandey from comment #26) > So , Is it now confirmed ? Working fine right ? The patch was fine Sagar, however the feature is no longer needed as the application is not being used. Thank you for your contribution, and I hope that you can find another bug to work on.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: