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

Could not find dependent Exec[concat_/etc/nginx/sites-available/connect.conf] #514

Closed
phpguru opened this issue Dec 4, 2014 · 2 comments

Comments

@phpguru
Copy link

phpguru commented Dec 4, 2014

I'm attempting to use this module inside a CentOS 6.5 Vagrantbox without a puppet master, and with the following in Vagrantfile

config.vm.provision :shell, :run => "always" do |shell|
  shell.inline = "
      mkdir -p /etc/puppet/modules;
      puppet module list | grep puppetlabs-stdlib || puppet module install puppetlabs-stdlib;
      puppet module list | grep puppetlabs-concat || puppet module install puppetlabs-concat;
      puppet module list | grep puppetlabs-nodejs || puppet module install puppetlabs-nodejs;
      puppet module list | grep puppetlabs-mongodb || puppet module install puppetlabs-mongodb;
      puppet module list | grep jfryman-nginx || puppet module install jfryman-nginx;
      puppet module list | grep mayflower-php || puppet module install mayflower-php;
      puppet module list | grep fsalum-redis || puppet module install fsalum-redis;
      "
end

config.vm.provision :puppet, :run => "always" do |puppet|
  puppet.manifests_path = "manifests"
  puppet.manifest_file  = "default.pp"
end

Here is the relevant portion of my default.pp

# Install nginx
class { 'nginx': }

nginx::resource::location { "/vagrant/web":
  ensure         => present,
  www_root       => '/vagrant/web',
  location       => '/',
  vhost          => 'website',
  fastcgi        => "127.0.0.1:9000",
  fastcgi_param  => {
    'APP_ENV' => 'local',
  },
}

When running vagrant reload:

==> default: Running provisioner: shell...
    default: Running: inline script
==> default: ├── puppetlabs-stdlib (v4.4.0)
==> default: ├── puppetlabs-concat (v1.1.2)
==> default: ├── puppetlabs-nodejs (v0.6.1)
==> default: ├── puppetlabs-mongodb (v0.9.0)
==> default: ├── jfryman-nginx (v0.2.1)
==> default: ├── mayflower-php (v2.0.2)
==> default: ├── fsalum-redis (v1.0.3)
==> default: Running provisioner: puppet...
==> default: Running Puppet with default.pp...
==> default: Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
==> default: Notice: Compiled catalog for myserver.local in environment production in 1.51 seconds
==> default: Error: Could not find dependent Exec[concat_/etc/nginx/sites-available/connect.conf] for File[/var/lib/puppet/concat/_etc_nginx_sites-available_connect.conf/fragments/500_c62cb06b56eddd8406856003a7c140f9] at /etc/puppet/modules/concat/manifests/fragment.pp:123

At first I figured I was just missing puppetlabs-stdlib or puppetlabs-concat, but after adding those the issue still occurs.

@jfryman
Copy link
Contributor

jfryman commented Dec 4, 2014

Your location block is only a sub-entry underneath a vhost resource. In order for this to work, you'll need to add a nginx::resource::vhost entry called website.

Take a look at this example: https://github.com/jfryman/puppet-nginx#example-puppet-class-calling-nginxvhost-with-https-fastcgi-and-redirection-of-http. It'll demonstrate the relationship between the location and the vhost.

Sorry this is not super straightforward. Documentation cleanups are in the works. :)

@jfryman jfryman closed this as completed Dec 4, 2014
@phpguru
Copy link
Author

phpguru commented Dec 4, 2014

I'm not using hiera and assume I am just doing something dumb. When I try to define a location with a vhost using the example you provide in the source, I get Error: Duplicate declaration: Concat::Fragment[c62cb06b56eddd8406856003a7c140f9] is already declared in file /etc/puppet/modules/nginx/manifests/resource/location.pp:359; cannot redeclare at /etc/puppet/modules/nginx/manifests/resource/location.pp:359

nginx::resource::vhost { "website":
    ensure                => present,
    listen_port           => 82,
    www_root              => '/vagrant/web',
    index_files           => [ 'index.php' ],
}

nginx::resource::location { "/vagrant/web":
  ensure         => present,
  location       => '/',
  vhost          => 'website',
  fastcgi        => "127.0.0.1:9000",
  fastcgi_param  => {
    'APP_ENV' => 'local',
  },
}

When I remove the vhost from the location block, I get

Error: Cannot create a location reference without attaching to a virtual host at /etc/puppet/modules/nginx/manifests/resource/location.pp:309 on node localhost.sheknows.local

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

2 participants