Chassis / puppet-wp

This module enables the easy use of WP CLI to control your WordPress site through Puppet manifests
https://chassis.github.io/puppet-wp/
GNU Lesser General Public License v3.0
44 stars 39 forks source link

Could not find dependency Package[] for Exec[wp-cli install] at modules/wp/manifests/cli.pp:48 #11

Closed guaka closed 10 years ago

guaka commented 10 years ago
Could not find dependency Package[] for Exec[wp-cli install] at modules/wp/manifests/cli.pp:48

eh?

guaka commented 10 years ago

Before I forget, I also added a manifests/init.pp, which seems quite essential:

class wp {

}
guaka commented 10 years ago

[[Uncommenting]] Commenting the Package requirements in cli.pp seems to help:

# Package[ 'curl' ],
# Package[ "$phpprefix-cli" ],
# Package[ 'git' ]

Now I get this though:

err: /Stage[main]/Wp::Cli/Package[]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install ' returned : Reading package lists...
Building dependency tree...
Reading state information...
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::compare

notice: /Stage[main]//Node[myhost]/Wp::Site[/var/www/mydir]/Exec[wp install /var/www/mydir]: Dependency Package[] has failures: true
warning: /Stage[main]//Node[myhost]/Wp::Site[/var/www/mydir]/Exec[wp install /var/www/mydir]: Skipping because of failed dependencies
notice: Finished catalog run in 3.94 seconds
err: Failed to apply catalog: No title provided and "Package[]" is not a valid resource reference
guaka commented 10 years ago

(All of this is on Ubuntu 12.04.3 LTS.)

rmccue commented 10 years ago

Before I forget, I also added a manifests/init.pp, which seems quite essential:

There should already be a manifests/init.pp in puppet-wp?

Uncommenting the Package requirements in cli.pp seems to help:

There shouldn't be any commented requirements there?

guaka commented 10 years ago

I meant commenting.

re init.pp, weird, I'll clone a clean repo now and see if there are any diffs.

guaka commented 10 years ago

Fresh clone, master branch:

$ wc manifests/init.pp
0 0 0 manifests/init.pp
rmccue commented 10 years ago

Yep, it's intentionally blank (it doesn't need to do anything).

What's your full manifest file?

guaka commented 10 years ago

The one for my host?

rmccue commented 10 years ago

Yeah, the one you're running puppet apply on.

guaka commented 10 years ago
import "basenode.pp"

node "myhost" inherits basenode {

include mysql::server

mysql::db { 'mysite':
  user     => 'mysite',
  password => 'randomstuff',
}

# Setup the site
$wplocation = '/var/www/mysite'
notify {$wplocation:}

wp::site {$wplocation:
    location => $wplocation,
    url => 'http://mysite',
    name => 'Mysite',
    require => Mysql::Db['mysite']
}

}

I'll try to leave out the subclass stuff next. (once more, I'm really a puppet noob, someone helped me get started :)

guaka commented 10 years ago

ah, it seems indeed that init.pp can be empty, but then I should not use include wp, which is also fine, that still leaves the command /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install without a package now.

guaka commented 10 years ago

Ah, to avoid

Could not find dependency Package[] for Exec[wp-cli install] at /usr/local/teak-etc/etc/puppet/modules/wp/manifests/cli.pp:48

I only have to uncomment this:

  # Package[ "$phpprefix-cli" ],

So I guess the $phpprefix-cli variable is empty, possibly related to #9 and #12 :)

guaka commented 10 years ago

Either my puppet parses $phpprefix-cli as a complete variable or $phpprefix is not set either. But adding this at line 12:

     $phpprefix-cli = 'php5-cli'

takes a me step further!

rmccue commented 10 years ago

None of the package {} lines should be commented, same for any of the Package[] requirements. Doing so will break it.

I tested your configuration and it worked. What version of Puppet are you using?

guaka commented 10 years ago

Default from Ubuntu 12.04.3 LTS

$ puppet --version
2.7.11
rmccue commented 10 years ago

$phpprefix is set, so obviously it's just a problem with Puppet's parsing. Try upgrading to 2.7.19 (which is what I'm running) if you can, otherwise, change the $phpprefix-cli line to ${phpprefix}-cli

guaka commented 10 years ago

Yay, ${phpprefix}-cli is much better!

Now I'm just left with:

err: /Stage[main]//Node[myhost]/Wp::Site[/var/www/mysite]/Exec[wp install /var/www/mysite]/returns: change from notrun to 0 failed: Working directory '/var/www/mysite' does not exist
rmccue commented 10 years ago

That's likely because the directory doesn't exist. :)

guaka commented 10 years ago

BTW, I thought wp-cli or puppet-wp would take care of mkdir -p for new sites. I'll add a feature request :)

rmccue commented 10 years ago

Nope; puppet-wp is only responsible for running the installation. Your WordPress installation should probably be managed as part of a code repository.

rmccue commented 10 years ago

See also #7.

guaka commented 10 years ago

Ah, okay, cool, that clarifies things a bit. I think the current README.md misled me because of the wp::{option|rewrite|plugin}} stuff.

rmccue commented 10 years ago

That is: you can do it, but it's not a best practice. :)