Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Archive management #83

Merged
merged 5 commits into from Aug 9, 2018
Merged

Add Archive management #83

merged 5 commits into from Aug 9, 2018

Conversation

smarlowucf
Copy link
Collaborator

@smarlowucf smarlowucf commented May 24, 2018

Allow for archiving of ipa results. All results and log files in addition to the history log will be copied to a tarball.

  • Options --clear-log option will clear the history once the archive has complete.
  • --items accepts a coma separated list of values to be archived. Using --clear-log in conjunction with --items will delete all items in the provided list from history file.

Fixes #1.

@smarlowucf
Copy link
Collaborator Author

smarlowucf commented Jun 18, 2018

@rjschwei Added items option to choose specific items to archive and rebased against master.

time_stamp = datetime.now().strftime('%Y%m%d%H%M%S')
file_name = ''.join(['ipa_', time_stamp, '.tar.gz'])
archive_path = os.path.join(path, file_name)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the user should have the option to give the archive a name that is meaningful to them rather than using the date based naming scheme in this case.

shutil.copyfile(log_src, destination_path)
shutil.copyfile(results_src, os.path.join(destination, results_dest))
except Exception:
pass # File does not exist, nothing we can do now.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should log or print an info message that tells the user that the selected item was not found and based on the "else" clause we should abandon the archive operation at this point all together, more below.

except Exception:
pass # File does not exist, nothing we can do now.
else:
# Only update the archive results log if no error occur.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have two options, best effort, or give up on error. Implementation appears to be inconsistent. An exception on finding a file we try to archive is ignored, that implies best effort, but with the else clause we do not clean up the history for the files that were archived, which implies "give up on error".

In this case I would tend to follow th e"give up on error" approach as we can presume the user has a certain set of results in mind that should be archived and when that set cannot be met we should not do anything but tell the user of the problem. So the exception of the results copy should trigger bail out logic.

Allow history log and results + log files to be archived to a
single tar file. The additional clear flag will empty the history
log once the results are backed up.
If --clear-log option is used with --items only the items in list
will be deleted from history file.
- Path and name will be used as full path to archive tarball.
- If there are missing log/results files for a history item fail
eagerly and let the user fix the issue before creating an archive.
@rjschwei rjschwei merged commit 425cd6d into master Aug 9, 2018
@smarlowucf smarlowucf deleted the archive-management branch August 9, 2018 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants