Vagrant 木偶Apt模块:依赖循环

Vagrant 木偶Apt模块:依赖循环,vagrant,puppet,Vagrant,Puppet,在流浪汉傀儡供应器中使用puppetlabs/apt。该模块安装在puppet/modules中,我得到一个奇怪的依赖循环错误。 清单文件中的代码: # Run apt-get update when anything beneath /etc/apt/ changes #taken from https://blog.kumina.nl/2010/11/puppet-tipstricks-running-apt-get-update-only-when-needed/ exec { "apt-

在流浪汉傀儡供应器中使用
puppetlabs/apt
。该模块安装在puppet/modules中,我得到一个奇怪的依赖循环错误。 清单文件中的代码:

# Run apt-get update when anything beneath /etc/apt/ changes
#taken from https://blog.kumina.nl/2010/11/puppet-tipstricks-running-apt-get-update-only-when-needed/
exec { "apt-get update":
command => "/usr/bin/apt-get update",
onlyif => "/bin/sh -c '[ ! -f /var/cache/apt/pkgcache.bin ] || /usr/bin/find /etc/apt/* -cnewer /var/cache/apt/pkgcache.bin | /bin/grep . > /dev/null'",
}

package {
    ["build-essential","apache2","git","python","python-dev","python-setuptools", "python-pip"]:
    ensure => present,
    require => Exec["apt-get update"],
    }

class { 'apt':

        }
include apt

apt::builddep { ["python-imaging","python-lxml"]:
    require => Class['apt'] 
 }

class {'nodejs':

}
include nodejs

package {"less":
    ensure => present,
    provider => 'npm',
    require => Package['npm'],

}
事实上,我注意到了类似的问题,但答案并不令人满意。 错误消息:

←[0;37mdebug: /Stage[main]//Package[python-virtualenv]/require: requires Package
[python-pip]←[0m
←[0;37mdebug: /Stage[main]//Package[python-virtualenv]/require: requires Package
[python-setuptools]←[0m
←[0;37mdebug: /Stage[main]/Apt/File[configure-apt-proxy]/notify: subscribes to E
xec[apt_update]←[0m
←[0;37mdebug: /Stage[main]/Apt/Anchor[apt::update]/require: requires Class[Apt::
Update]←[0m
←[0;37mdebug: /Stage[main]/Apt/File[sources.list.d]/notify: subscribes to Exec[a
pt_update]←[0m
←[0;37mdebug: /Stage[main]//Package[python-pip]/require: requires Exec[apt-get u
pdate]←[0m
←[0;37mdebug: /Stage[main]//Apt::Builddep[python-lxml]/Exec[apt-builddep-python-
lxml]/notify: subscribes to Exec[apt_update]←[0m
←[0;37mdebug: /Stage[main]//Package[apache2]/require: requires Exec[apt-get upda
te]←[0m
←[0;37mdebug: /Stage[main]//Package[python-dev]/require: requires Exec[apt-get u
pdate]←[0m
←[0;37mdebug: /Stage[main]/Nodejs/Package[npm]/require: requires Anchor[nodejs::
repo]←[0m
←[0;37mdebug: /Stage[main]/Nodejs/Package[nodejs]/require: requires Anchor[nodej
s::repo]←[0m
←[0;37mdebug: /Stage[main]//Package[python]/require: requires Exec[apt-get updat
e]←[0m
←[0;37mdebug: /Stage[main]//Package[build-essential]/require: requires Exec[apt-
get update]←[0m
←[0;37mdebug: /Stage[main]//Apt::Builddep[python-imaging]/require: requires Clas
s[Apt]←[0m
←[0;37mdebug: /Stage[main]//Package[git]/require: requires Exec[apt-get update]←
[0m
←[0;37mdebug: /Stage[main]//Package[less]/require: requires Package[npm]←[0m
←[0;37mdebug: /Stage[main]//Package[sphinx]/require: requires Package[python-pip
]←[0m
←[0;37mdebug: /Stage[main]//Apt::Builddep[python-imaging]/Anchor[apt::builddep::
python-imaging]/require: requires Class[Apt::Update]←[0m
←[0;37mdebug: /Stage[main]//Package[python-setuptools]/require: requires Exec[ap
t-get update]←[0m
←[0;37mdebug: /Stage[main]/Apt/File[sources.list]/notify: subscribes to Exec[apt
_update]←[0m
←[0;37mdebug: /Stage[main]//Apt::Builddep[python-imaging]/Exec[apt-builddep-pyth
on-imaging]/notify: subscribes to Exec[apt_update]←[0m
←[0;37mdebug: /Stage[main]//Apt::Builddep[python-lxml]/Anchor[apt::builddep::pyt
hon-lxml]/require: requires Class[Apt::Update]←[0m
←[0;37mdebug: /Stage[main]//Apt::Builddep[python-lxml]/require: requires Class[A
pt]←[0m
←[1;35merr: Could not apply complete catalog: Found 1 dependency cycle:
(Anchor[apt::update] => Class[Apt] => Apt::Builddep[python-lxml] => Exec[apt-bui
lddep-python-lxml] => Exec[apt_update] => Class[Apt::Update] => Anchor[apt::upda
te])
Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or
 GraphViz←[0m

有已知的工作吗?解决方案?

您的清单有点不可靠

  • 您可以定义自己的
    Exec[“apt get update”]
    ,尽管
    apt
    模块声明了一个
    apt\u update
    您可以使用
  • 类{'apt':}include apt
    是冗余的。除非需要声明参数,否则请避免使用
    class{}
    语法
  • 这些都是表面上的问题。可以想象,打破依赖关系的是

    apt::builddep { ["python-imaging","python-lxml"]:
        require => Class['apt'] 
    }
    
    这一要求似乎没有意义,我建议您让
    apt
    模块处理它自己的内部依赖关系/顺序,然后它就可以工作了

    apt::builddep { ["python-imaging","python-lxml"]: }
    
    当然:-)但它并没有关闭或更新,所以我认为一些见解可能会有所帮助-如果不是对你,那么可能是未来的读者。