Puppet 无法使用 ensure installed/latest 降级
Puppet can't downgrade with ensure installed/latest
我在 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-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'],
}
我会留下这个问题,因为这个答案不安全。
--force-yes
Force yes; this is a dangerous option that will cause apt to continue
without prompting if it is doing something potentially harmful. It
should not be used except in very special situations. Using force-yes
can potentially destroy your system! Configuration Item:
APT::Get::force-yes. This is deprecated and replaced by
--allow-downgrades, --allow-remove-essential,
--allow-change-held-packages in 1.1.
选项#2
如果您的节点是 运行 具有 apt 版本 1.1 或更高版本的系统,您可以使用 --allow-downgrades
而不是 --force-yes
。这是一个更安全的选项,但在手册页中仍然不推荐:
--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 的版本。
我在 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-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'],
}
我会留下这个问题,因为这个答案不安全。
--force-yes
Force yes; this is a dangerous option that will cause apt to continue
without prompting if it is doing something potentially harmful. It
should not be used except in very special situations. Using force-yes
can potentially destroy your system! Configuration Item:
APT::Get::force-yes. This is deprecated and replaced by
--allow-downgrades, --allow-remove-essential,
--allow-change-held-packages in 1.1.
选项#2
如果您的节点是 运行 具有 apt 版本 1.1 或更高版本的系统,您可以使用 --allow-downgrades
而不是 --force-yes
。这是一个更安全的选项,但在手册页中仍然不推荐:
--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 的版本。