我正在通过Augeas测试以下配置更改,
$rhsm_repo_name="rhel-7-server-restricted-maintenance-oracle-java-rpms"
augeas { "enable_repo-oracle-java":
lens => 'Yum.lns',
incl => '/etc/yum.repos.d/redhat.conf'
changes => "set ${rhsm_repo_name}/enabled 1",
onlyif => "get ${rhsm_repo_name}/enabled != 1"
}
我可以看到Puppet接受了更改,但实际上并未应用到磁盘上。
Debug: Augeas[enable_repo-oracle-java](provider=augeas): Opening augeas with root /, lens path , flags 64
Debug: Augeas[enable_repo-oracle-java](provider=augeas): Augeas version 1.8.1 is installed
Debug: Augeas[enable_repo-oracle-java](provider=augeas): Will attempt to save and only run if files changed
Debug: Augeas[enable_repo-oracle-java](provider=augeas): sending command 'set' with params ["/files/etc/yum.repos.d/redhat.repo/rhel-7-server-restricted-maintenance-oracle-java-rpms/enabled", "0"]
Debug: Executing: 'diff -u /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/redhat.repo.augnew'
Notice: Augeas[enable_repo-oracle-java](provider=augeas):
--- /etc/yum.repos.d/redhat.repo 2018-07-03 14:07:11.311347311 +1000
+++ /etc/yum.repos.d/redhat.repo.augnew 2018-07-03 14:07:11.748351467 +1000
@@ -211,6 +211,6 @@
name = Red Hat Enterprise Linux 7 Server - Oracle Java (Restricted Maintenance) (RPMs)
sslclientkey = /etc/pki/entitlement/4300433479328162798-key.pem
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
-enabled = 0
+enabled = 1
sslcacert = /etc/rhsm/ca/katello-server-ca.pem
gpgcheck = 1
Debug: Augeas[enable_repo-oracle-java](provider=augeas): Files changed, should execute
Debug: Augeas[enable_repo-oracle-java](provider=augeas): sending command 'set' with params ["/files/etc/yum.repos.d/redhat.repo/rhel-7-server-restricted-maintenance-oracle-java-rpms/enabled", "0"]
Debug: Augeas[enable_repo-oracle-java](provider=augeas): Closed the augeas connection
Notice: /Stage[main]/Cubic_yumrepos::Client/Augeas[enable_repo-oracle-java]/returns: executed successfully
当我使用augtool玩耍时,情况也是如此。
augtool> print /files//etc/yum.repos.d/redhat.repo/rhel-7-server-restricted-maintenance-oracle-java-rpms/enabled
/files/etc/yum.repos.d/redhat.repo/rhel-7-server-restricted-maintenance-oracle-java-rpms/enabled = "0"
augtool> set /files/etc/yum.repos.d/redhat.repo/rhel-7-server-restricted-maintenance-oracle-java-rpms/enabled "1"
augtool> print /files//etc/yum.repos.d/redhat.repo/rhel-7-server-restricted-maintenance-oracle-java-rpms/enabled
/files/etc/yum.repos.d/redhat.repo/rhel-7-server-restricted-maintenance-oracle-java-rpms/enabled = "1"
augtool> save
Saved 1 file(s)
augtool> quit
当我查看redhat.repo文件时,未应用更改。
rhel7-dev:tmp# cat /etc/yum.repos.d/redhat.repo | tail -15
[rhel-7-server-restricted-maintenance-oracle-java-rpms]
metadata_expire = 1
baseurl = redhat.com/repo/release/rhel7/
ui_repoid_vars = releasever basearch
name = Red Hat Enterprise Linux 7 Server - Oracle Java (Restricted Maintenance) (RPMs)
enabled = 0
gpgcheck = 1
我在这里做错什么了吗?我不知道。