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

How do you ensure unzip is installed? #356

Closed
cgetzen opened this issue Jul 31, 2017 · 6 comments
Closed

How do you ensure unzip is installed? #356

cgetzen opened this issue Jul 31, 2017 · 6 comments

Comments

@cgetzen
Copy link

cgetzen commented Jul 31, 2017

When puppet-consul is in a Puppetfile, the follow error occurs:
Error: Execution of 'unzip -o /opt/consul/archives/consul-0.7.5.zip' returned 1

Error: /Stage[main]/Consul::Install/Archive[/opt/consul/archives/consul-0.7.5.zip]/creates: change from archive not extracted to extracting in /opt/consul/archives/consul-0.7.5 to create /opt/consul/archives/consul-0.7.5/consul failed: Execution of 'unzip -o /opt/consul/archives/consul-0.7.5.zip' returned 1

How can we ensure unzip is installed before this, only using puppet? Don't we have to add unzip to metadata.json dependencies?

If I apt-get install unzip before running puppet it installs cleanly, but I am having trouble getting that into puppet.

@solarkennedy
Copy link
Contributor

I recommend using the "ensure_packages" function to install unzip using puppet:

ensure_packages(['unzip'])

This requires the puppet stdlib:
https://github.com/puppetlabs/puppetlabs-stdlib#ensure_packages

This module uses the puppet-archive module to download zips and it is the users responsibility to install the needed utilities:
https://github.com/voxpupuli/puppet-archive#setup

@cgetzen
Copy link
Author

cgetzen commented Aug 1, 2017

Thank you for your reply!
I have ensure_packages, but I think it is being loaded in the wrong order with librarian-puppet. My structure looks like this:

/modules
/my_modules
--/base
--/--/manifests/init.pp --> contains "ensure_packages"
/Puppetfile

Puppetfile:

...
mod 'KyleAnderson-consul' ...
mod 'my-base',                  path: 'my_modules/base'

So if I run puppet twice, it will work, because my-base is being run second. Is there a way to show a dependency between these modules?

@solarkennedy
Copy link
Contributor

Package['unzip'] -> Class['consul']

You can read more about this in the docs for puppet ordering dependencies:
https://docs.puppet.com/puppet/5.0/lang_relationships.html

@Justin-DynamicD
Copy link
Contributor

why isn't this simply part of the module? It's essentially a dependency and the module fails without it.

@solarkennedy
Copy link
Contributor

It is presumptuous to automatically install a dependency in puppet; it is easy to conflict with an existing definition of `Package['unzip']. Also not everyone installs consul from zips (I use a system package).

There is no "official" unzip puppet module to depend on, so we make it an optional dependency and leave it up to to user to install it as they see fit.

Keep in mind we are just using
https://github.com/voxpupuli/puppet-archive
If you think that module should be automatically installing wget/curl/unzip/etc for the user when fetching zips, open an issue with that module.

@Justin-DynamicD
Copy link
Contributor

Thank you for clarifying the fault lies with puppet-archive, I will open an issue.

However I fundamentally disagree that expecting a module to work with a simple include is presumptuous. That should just be the baseline of a good module, especially as we can use ensure_packages as mentioned earlier and avoid conflicts.

Bottom line is the default settings require a url pull and the use of unzip, and that has a chance of failing. If it's really an ""optional dependency" then it shouldn't be the default option. Simply flip the default to package and then you can be sure the "simplest route works".

Seems like an easy tweak that avoids unnecessary complications.

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

No branches or pull requests

3 participants