-
Notifications
You must be signed in to change notification settings - Fork 70
Adds -a option to genanswers to designate where to put answers.conf #638
base: master
Are you sure you want to change the base?
Conversation
#dotests |
openshift tests = false positive? the timeout issue occured |
Tests pass locally 👍 |
@@ -53,9 +53,10 @@ def print_app_location(app_path): | |||
def cli_genanswers(args): | |||
try: | |||
argdict = args.__dict__ | |||
location = argdict['answers'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if I like this. The reason you are converting from answers
to location
is because "answers" doesn't really make sense as a variable name for this I don't think.
How about we use --destination
instead and the user could provide a path (./path/to/myanswers.conf
) or a directory (./path/to/
) in which the program will tack on the default filename to the directory.
@jberkus, do you think --answers
makes sense, or should we change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was thinking that too, using --destination
to coincide with how we do fetch
. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are to leave it as -a
then I'd rather not do this here but rather leave it as answers
and comment in the function in main.py
what it is being used for.
The reason to use -a is symmetry:
I understand the arguments for other parameters, but I don't find them persuasive. Anything other than -a is going to require me to look it up. |
This is partly why I decided to have the only behavior to be to put the file in your cwd. If it has one behavior then it is certainly easy to remember. :-P |
Except that using the CWD is asymmetrical. That is, "run" requires -a if you want to use an answers.conf, it won't use CWD. |
@dustymabe Should we change this to --destination or stick to -a ? What's your opinion? |
@cdrage here's the instructions I want to be able to give:
See the advantage in usability from being symmetric with the use of the |
Relevant to this, the PostgreSQL project used to have different parameters for different commands when it came to databases and the data directory. After years of user bug reports, we refactored and made them consistent; all CLI commands use -D for the data directory and -d for the database, or they don't support those parameters. And the letter 'd' is used for nothing else. Let's start out by being consistent instead of having to refactor later. |
if a directory is not supplied, yes. but if you do this:
... then it would create it in |
d7cd453
to
555c942
Compare
Fixues issue: projectatomic#588 Adds the feature to specify the destination of your answers.conf file generation.
555c942
to
4d87fb3
Compare
#dotests |
Updated this PR to include checking if the directory exists + rebased against master |
@@ -52,9 +52,10 @@ def print_app_location(app_path): | |||
|
|||
def cli_genanswers(args): | |||
argdict = args.__dict__ | |||
location = argdict['answers'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't think we need to do this here. What do you think about just passing it in with the rest of the args and do it inside the function in main.py ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following similar to how we do:
destination = argdict['destination']
Should we not follow this convention / convert to do this later in main.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you were trying to do now. this seems reasonable. +1
Ok a few comments in the code. We also need to decide exactly "what" happens when. Let's create a few cases:
The hard part about this is number 2. How do we know if the user provided the path to a file that they wanted us to create or they provided us a path to a directory that doesn't exist? I think we should just make them give us a full file name when providing -a. That way it is simple: if dirname(file) doesn't exist => error |
Will continue on this once #658 is merged so we can use the "are we in a container" util |
No need to wait as we already have the Utils.inContainer() function. |
Update: I'm going to pick back up on this soon. ^^ |
Fixues issue:
#588
Adds the feature to specify the destination of your answers.conf file
generation.