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

Error: Cannot create /opt/consul/archives; parent directory /opt/consul does not exist #311

Closed
claflico opened this issue Jan 4, 2017 · 11 comments

Comments

@claflico
Copy link

claflico commented Jan 4, 2017

I set my consul::config_hash::data_dir to '/var/lib/consul' in hiera so after upgrading to 2.0.0 I'm now getting the following error:

Error: Cannot create /opt/consul/archives; parent directory /opt/consul does not exist
Error: /Stage[main]/Consul::Install/File[/opt/consul/archives]/ensure: change from absent to directory failed: Cannot create /opt/consul/archives; parent directory /opt/consul does not exist

I initially changed consul::archive_path: '/tmp' but that made the /tmp dir on all my nodes 'a-w' so then I changed it to what used to be the default: consul::archive_path: '/opt/puppet-archive'

@solarkennedy
Copy link
Contributor

Can you try master? I'm pretty sure I fixed this in #308.

@shamil
Copy link

shamil commented Jan 12, 2017

@solarkennedy I'm hitting this as well, when the new version (with #308) will be released?

@solarkennedy
Copy link
Contributor

Released. Try 2.1.0.

@madAndroid
Copy link
Contributor

madAndroid commented Feb 21, 2017

We're still seeing this issue with 2.1.0 -

Error: Cannot create /opt/consul/archives; parent directory /opt/consul does not exist
Error: /Stage[main]/Consul::Install/File[/opt/consul/archives]/ensure: change from absent to directory failed: Cannot create /opt/consul/archives; parent directory /opt/consul does not exist
Notice: /Stage[main]/Consul::Install/File[/opt/consul/archives/consul-0.7.0]: Dependency File[/opt/consul/archives] has failures: true
Warning: /Stage[main]/Consul::Install/File[/opt/consul/archives/consul-0.7.0]: Skipping because of failed dependencies
Notice: /Stage[main]/Consul::Install/Archive[/opt/consul/archives/consul-0.7.0.zip]: Dependency File[/opt/consul/archives] has failures: true
Warning: /Stage[main]/Consul::Install/Archive[/opt/consul/archives/consul-0.7.0.zip]: Skipping because of failed dependencies
Notice: /Stage[main]/Consul::Install/File[/opt/consul/archives/consul-0.7.0/consul]: Dependency File[/opt/consul/archives] has failures: true
Warning: /Stage[main]/Consul::Install/File[/opt/consul/archives/consul-0.7.0/consul]: Skipping because of failed dependencies
Notice: /Stage[main]/Consul::Install/File[/usr/local/bin/consul]: Dependency File[/opt/consul/archives] has failures: true
Warning: /Stage[main]/Consul::Install/File[/usr/local/bin/consul]: Skipping because of failed dependencies
Notice: /Stage[main]/Consul::Config/File[/etc/consul]: Dependency File[/opt/consul/archives] has failures: true
Warning: /Stage[main]/Consul::Config/File[/etc/consul]: Skipping because of failed dependencies
Notice: /Stage[main]/Consul::Config/File[consul config.json]: Dependency File[/opt/consul/archives] has failures: true
Warning: /Stage[main]/Consul::Config/File[consul config.json]: Skipping because of failed dependencies
Notice: /Stage[main]/Profile_influx/Consul::Service[metrics]/File[/etc/consul/service_metrics.json]: Dependency File[/opt/consul/archives] has failures: true
Warning: /Stage[main]/Profile_influx/Consul::Service[metrics]/File[/etc/consul/service_metrics.json]: Skipping because of failed dependencies

@madAndroid
Copy link
Contributor

This appears to be an ordering issue - we're seeing this happening in our integration testing for a few of our profile modules, but not all of them. When the catalog ordering is such that the file resource for the data_dir is not created before the archive is managed, we see this error - but not in all of our profile modules. I'll send a PR with some explicit ordering, once confirmed to be working as expected.

@madAndroid
Copy link
Contributor

Please ignore the above, looks like we've not been setting data_dir in the profile, which was causing this

@warmfusion
Copy link

This isn't resolved.

There is an ordering issue between the creation of /opt/consul and its use on the install path, but it appears to be caused by the 'archive' action;

Info: Applying configuration version '1490782076'
Error: Cannot create /opt/consul/archives; parent directory /opt/consul does not exist
Error: /Stage[main]/Consul::Install/File[/opt/consul/archives]/ensure: change from absent to directory failed: Cannot create /opt/consul/archives; parent directory /opt/consul does not exist
Notice: /Stage[main]/Consul::Install/File[/opt/consul/archives/consul-0.7.4]: Dependency File[/opt/consul/archives] has failures: true
Warning: /Stage[main]/Consul::Install/File[/opt/consul/archives/consul-0.7.4]: Skipping because of failed dependencies

Module Version: v2.1.1
Puppet 3.8.7
OS: Debian Jessie 8.6

@joshuaspence
Copy link
Contributor

I am seeing this error on the latest release (3.0.0). I was able to work around it by setting consul::archive_path in Hiera.

@solarkennedy
Copy link
Contributor

Hmm. Is there a commonality amongst these other bug reports? What is your data_dir and what is your install method?

@joshuaspence
Copy link
Contributor

I think I've managed to narrow it down. It seems to occur when $consul::config_defaults['data_dir'] is set (in our case it is set to /var/lib/consul), but $consul::config_hash is left as {}.

@jameseck
Copy link

I've just come across the same issue.
I'm setting the config_defaults hash in the common hiera hierarchy for all agents and then setting config_hash to server specific options in my consul servers role hierarchy.
For most of my servers, they are only using config from config_defaults, config_hash is empty.

I believe this is due to the code:
manifests/install.pp:39: $install_prefix = pick($consul::config_hash[data_dir], '/opt/consul')

This only uses the data_dir from $config_hash, not $config_defaults or even the $config_defaults_real hash which actually contains the full config.

I've worked around it by creating a profile module for consul and adding a file { '/opt/consul': ensure => directory } resource.

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

7 participants