Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Puppet 木偶罐头';t在确保已安装/最新的情况下降级_Puppet - Fatal编程技术网

Puppet 木偶罐头';t在确保已安装/最新的情况下降级

Puppet 木偶罐头';t在确保已安装/最新的情况下降级,puppet,Puppet,我正在木偶清单中使用以下内容: $packages = [ '2klic-gateway=2.10.5', ] package { $packages: ensure => latest } 还尝试使用installed而不是latest。但我得到了以下错误: Error: Could not update: Execution of '/usr/bin/apt-get q -y -o DPkg::Options::=-force-confold install 2klic-gat

我正在木偶清单中使用以下内容:

$packages = [
  '2klic-gateway=2.10.5',
]

package { $packages: ensure => latest }
还尝试使用
installed
而不是
latest
。但我得到了以下错误:

Error: Could not update: Execution of '/usr/bin/apt-get q -y -o DPkg::Options::=-force-confold install 2klic-gateway=2.10.5' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
2klic-updates
Use 'apt-get autoremove' to remove it.
The following packages will be DOWNGRADED:
2klic-gateway
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 5 not upgraded.
Need to get 22.0 MB of archives.
After this operation, 312 kB disk space will be freed.
E: There are problems and -y was used without --force-yes
Error: /Stage[main]/Main/Node[default]/Package[2klic-gateway=2.10.5]/ensure: change from purged to latest failed: Could not update: Execution of '/usr/bin/apt-get q -y -o DPkg::Options::=-force-confold install 2klic-gateway=2.10.5' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
2klic-updates
Use 'apt-get autoremove' to remove it.
The following packages will be DOWNGRADED:
2klic-gateway
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 5 not upgraded.
Need to get 22.0 MB of archives.
After this operation, 312 kB disk space will be freed.
E: There are problems and -y was used without --force-yes
如果我手动ssh到节点中,我可以使用
apt get install 2klic gateway=2.10.5
,它可以正常工作。我还可以删除程序,然后运行puppet,清单工作正常。但只要我添加
-y
标志,我就会得到:

E: There are problems and -y was used without --force-yes

我可以通过告诉Puppet在这样安装时使用
--force yes
来修复此问题:

package { 
  $packages: ensure => installed,
  install_options   => ['--force-yes'],
}
我将保留这个问题,因为这个答案不安全


选项2

如果您的节点运行的系统具有apt版本1.1或更高版本,则可以使用
--允许降级
,而不是
--强制是
。这是一个更安全的选项,尽管手册页中仍不推荐:

 --allow-downgrades
       This is a dangerous option that will cause apt to continue without
       prompting if it is doing downgrades. It should not be used except
       in very special situations. Using it can potentially destroy your
       system! Configuration Item: APT::Get::allow-downgrades. Introduced
       in APT 1.1.
不幸的是,在我的情况下,我的节点正在运行apt版本1,因此这需要首先升级apt版本。

谢谢--允许升级帮助修复了一个系统,该系统由于配置中的Apt类而引入了一些Backport包。对于保持DKM的内核头-${kernelrelease}同步也很有效。
 --allow-downgrades
       This is a dangerous option that will cause apt to continue without
       prompting if it is doing downgrades. It should not be used except
       in very special situations. Using it can potentially destroy your
       system! Configuration Item: APT::Get::allow-downgrades. Introduced
       in APT 1.1.