当由puppet控制的文件将由yum更改时通知

前端之家收集整理的这篇文章主要介绍了当由puppet控制的文件将由yum更改时通知前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当包含由puppet控制的文件的包即将更改该文件时,是否可以在控制台上收到通知?这意味着,在yum做yum更新时,是否可以注入自定义警告?
Yum支持插件,因此完全可以编写一个读取缓存的puppet清单的插件,并在事务覆盖木偶控制的文件时发出警告.我不知道有一个现有的插件可以做到这一点,但我可能会写一个自己写的,因为我喜欢这个想法.

插件会检查所有新安装/升级/降级的软件包,告诉您它将覆盖哪些木偶管理的文件,并要求确认这样做.

[root@camel ~]# yum update pam
    Loaded plugins: puppet,security
    Skipping security plugin,no data
    Setting up Update Process
    Resolving Dependencies
    Skipping security plugin,no data
    --> Running transaction check
    ---> Package pam.i386 0:0.99.6.2-12.el5 set to be updated
    ---> Package pam.x86_64 0:0.99.6.2-12.el5 set to be updated
    --> Finished Dependency Resolution

    Dependencies Resolved

    ===============================================================================================================================================================
     Package                           Arch                                 Version                                       Repository                          Size
    ===============================================================================================================================================================
    Updating:
     pam                               i386                                 0.99.6.2-12.el5                               base                               983 k
     pam                               x86_64                               0.99.6.2-12.el5                               base                               982 k

    Transaction Summary
    ===============================================================================================================================================================
    Install       0 Package(s)
    Upgrade       2 Package(s)

    Total download size: 1.9 M
    Is this ok [y/N]: y
    Downloading Packages:
    (1/2): pam-0.99.6.2-12.el5.x86_64.rpm                                                                                                   | 982 kB     00:00
    (2/2): pam-0.99.6.2-12.el5.i386.rpm                                                                                                     | 983 kB     00:00
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                          8.7 MB/s | 1.9 MB     00:00
    Running rpm_check_debug
    Running Transaction Test
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Installing pam-0.99.6.2-12.el5.i386 overwrites puppet-managed file /etc/pam.d/system-auth
    Installing pam-0.99.6.2-12.el5.i386 overwrites puppet-managed file /etc/security/access.conf
    Installing pam-0.99.6.2-12.el5.i386 overwrites puppet-managed file /etc/security/limits.conf
    Installing pam-0.99.6.2-12.el5.x86_64 overwrites puppet-managed file /etc/pam.d/system-auth
    Installing pam-0.99.6.2-12.el5.x86_64 overwrites puppet-managed file /etc/security/access.conf
    Installing pam-0.99.6.2-12.el5.x86_64 overwrites puppet-managed file /etc/security/limits.conf
    Is this ok [y/N]: n


    Aborting
    [root@camel ~]# yum update pam
    Loaded plugins: puppet,no data
    --> Running transaction check
    ---> Package pam.i386 0:0.99.6.2-12.el5 set to be updated
    ---> Package pam.x86_64 0:0.99.6.2-12.el5 set to be updated
    --> Finished Dependency Resolution

    Dependencies Resolved

    ===============================================================================================================================================================
     Package                           Arch                                 Version                                       Repository                          Size
    ===============================================================================================================================================================
    Updating:
     pam                               i386                                 0.99.6.2-12.el5                               base                               983 k
     pam                               x86_64                               0.99.6.2-12.el5                               base                               982 k

    Transaction Summary
    ===============================================================================================================================================================
    Install       0 Package(s)
    Upgrade       2 Package(s)

    Total size: 1.9 M
    Is this ok [y/N]: y
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Installing pam-0.99.6.2-12.el5.i386 overwrites puppet-managed file /etc/pam.d/system-auth
    Installing pam-0.99.6.2-12.el5.i386 overwrites puppet-managed file /etc/security/access.conf
    Installing pam-0.99.6.2-12.el5.i386 overwrites puppet-managed file /etc/security/limits.conf
    Installing pam-0.99.6.2-12.el5.x86_64 overwrites puppet-managed file /etc/pam.d/system-auth
    Installing pam-0.99.6.2-12.el5.x86_64 overwrites puppet-managed file /etc/security/access.conf
    Installing pam-0.99.6.2-12.el5.x86_64 overwrites puppet-managed file /etc/security/limits.conf
    Is this ok [y/N]: y
      Updating       : pam                                                                                                                                     1/4
      Updating       : pam                                                                                                                                     2/4
      Cleanup        : pam                                                                                                                                     3/4
      Cleanup        : pam                                                                                                                                     4/4

    Updated:
      pam.i386 0:0.99.6.2-12.el5                                                    pam.x86_64 0:0.99.6.2-12.el5

    Complete!

插件本身可以找到in my github hacks repository.

2013年11月8日更新:

正如评论中暗示的那样,我现在把它变成了一个更大的项目来改善Yum和Puppet之间的互动.你可以找到它on GitHub.

猜你在找的Bash相关文章