我正在尝试安装django并使用puppet脚本克隆github项目。我使用的模块如下:
在 web.pp 文件中,我有:
import ' nodes.pp '
在 nodes.pp 文件中,我有:
node default {
include postgres
include git
include django
}
在git文件夹内的Manifests文件夹中的 init.pp 文件中,我有以下代码:
class git{
include git::install
}
class git::install{
package { 'git:':
ensure => present
}
}
define git::clone ( $path, $dir){
exec { "clone-$name-$path":
command => "/usr/bin/git clone git@github.com:$name $path/$dir",
creates => "$path/$dir",
require => [Class["git"], File[$path]],
}
}
在django文件夹内的Manifests文件夹中的 init.pp 文件中,我有以下代码:
class django{
include django::install, django::clone, django::environment
}
class django::install {
package { [ "python", "python-dev", "python-virtualenv", "python-pip",
"python-psycopg2", "python-imaging"]:
ensure => present,
}
}
class django::clone {
git::clone { 'My GitHub repository name':
path => '/home/vagrant/',
dir => 'django',
}
}
define django::virtualenv( $path ){
exec { "create-ve-$path":
command => "/usr/bin/virtualenv -q $name",
cwd => $path,
creates => "$path/$name",
require => [Class["django::install"]],
}
}
class django::environment {
django::virtualenv{ 've':
path => '/usr/local/app',
}
}
要运行脚本puppet,我使用命令:
sudo puppet apply --modulepath=/vagrant/modules /vagrant/manifests/web.pp
并运行此命令我收到以下错误:
Could not find dependency File[/home/vagrant/] for
Exec[clone-My GitHub repository name-/home/vagrant/] at
/vagrant/modules/git/manifests/init.pp:16
注意:名称“My GitHub存储库名称”在哪里,我正确地输入了我的github存储库的名称。
有什么问题,如何解决这个问题?
答案 0 :(得分:1)
你确定要为$ path声明文件资源吗?
你应该:
file { $path: ensure => directory }
您