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

Support for adding modules from an archive #31

Merged
merged 4 commits into from
Oct 25, 2021

Conversation

vpodzime
Copy link
Contributor

Just like when adding modules from a git repository.

Copy link
Member

@olehermanse olehermanse left a comment

Choose a reason for hiding this comment

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

Looks good in general. Thanks for working on this. Please rebase and fix merge conflicts. The test failure should already be addressed in master.

cfbs/commands.py Outdated
Comment on lines 312 to 340
# TODO: use Python modules instead of CLI tools?
if archive_type.startswith(_SUPPORTED_TAR_TYPES):
sh("cd %s; tar -xf %s" % (content_dir, archive_path))
elif archive_type == (".zip"):
sh("cd %s; unzip %s" % (content_dir, archive_path))
else:
raise RuntimeError("Unhandled archive type: '%s'. Please report this at %s." %
(url, "https://github.com/cfengine/cfbs/issues"))

os.unlink(archive_path)
Copy link
Member

@olehermanse olehermanse Oct 22, 2021

Choose a reason for hiding this comment

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

I guess tar is usually available, but I definitely know that I've had stuff not working because of missing unzip before. A python option would be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but TBH, I don't consider that too important for now. If you want to work with .zip archives, you most likely have unzip installed or you can easily install it. I can add a check and a proper error message, though.

.strip("/") also strips leading slashes.
So that it has a better chance working with git repositories that
are not at GitHub and various sources in general.

Ticket: CFE-3772
Changelog: None
Just like when adding modules from a git repository, but
downloading and extracting an archive instead of 'git clone'. The
archive needs to contain the 'cfbs.json' index file and one or
more modules.

Ticket: CFE-3772
Changelog: 'cfbs add' now supports adding modules from archives
Copy link
Member

@olehermanse olehermanse left a comment

Choose a reason for hiding this comment

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

ACK

Copy link
Member

@olehermanse olehermanse left a comment

Choose a reason for hiding this comment

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

ACK

@olehermanse olehermanse merged commit 153aeac into cfengine:master Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants