-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -131,7 +131,7 @@ def unpack(self, update=False, | |||
return Nulecule.load_from_path( | ||||
self.app_path, dryrun=dryrun, config=config) | ||||
|
||||
def genanswers(self, dryrun=False, answers_format=None, **kwargs): | ||||
def genanswers(self, dryrun=False, answers_format=None, location=None, **kwargs): | ||||
""" | ||||
Renders artifacts and then generates an answer file. Finally | ||||
copies answer file to the current working directory. | ||||
|
@@ -147,10 +147,19 @@ def genanswers(self, dryrun=False, answers_format=None, **kwargs): | |||
self.answers_format = answers_format or ANSWERS_FILE_SAMPLE_FORMAT | ||||
|
||||
# Check to make sure an answers.conf file doesn't exist already | ||||
answers_file = os.path.join(os.getcwd(), ANSWERS_FILE) | ||||
if location is None: | ||||
answers_file = os.path.join(os.getcwd(), ANSWERS_FILE) | ||||
else: | ||||
answers_file = os.path.join(location, ANSWERS_FILE) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Double sigh.. problems like this make me want to retire. Ok we need to handle this for both the "in container" and "native" cases. That means if we are inside a container and the path is absolute then we need to translate the path like is done here: https://github.com/projectatomic/atomicapp/blob/master/atomicapp/nulecule/main.py#L72 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused in regards to self.app_path. So if inContainer() comes back as true, we'd use the /host/ path, correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sigh.. another reason to retire :) The link i used was based on master.. which moved since I pasted the link.. lets try using a link where the content won't move: atomicapp/atomicapp/nulecule/main.py Line 76 in fdc8a0b
basically if the path is absolute then we want to convert to the equivalent path inside the container. we are using the |
||||
|
||||
if os.path.exists(answers_file): | ||||
raise NuleculeException( | ||||
"Can't generate answers.conf over existing file") | ||||
"Can't generate %s over existing file" % answers_file) | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be better to have the file at the end after a colon:
|
||||
|
||||
answers_folder = os.path.dirname(answers_file) | ||||
if not os.path.isdir(answers_folder): | ||||
raise NuleculeException( | ||||
"Directory %s does not exist." % answers_folder) | ||||
|
||||
# Call unpack to get the app code | ||||
self.nulecule = self.unpack(update=False, dryrun=dryrun, config=self.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:
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