Forum: CFEngine Help
Subject: How to skip installing package if already installed
Author: btomasini
Link to topic: https://cfengine.com/forum/read.php?3,26170,26170#msg-26170

Hello,

This is one of my first promises.  I am trying to setup apt to use multiverse, 
run apt-get update if repaired, and then follow on with installing 
ec2-api-tools.  It works fine.  However, all three steps are always run, even 
if the file is already uncommented, apt-get update has already been run.  How 
do I get cfengine to recognize that the system is already in the desired state? 
 

provisioning_tools is the bundle I am including in my bundlesequence

Ben



bundle agent enable_multiverse
{
  files:

      "/etc/apt/sources.list"
        comment => "Enable mutliverse in apt sources",
        edit_line => uncomment_lines_matching(".*deb.*multiverse.*","#"),
        classes => if_repaired("sources_list_changed");

  commands:

    sources_list_changed::
      "/usr/bin/apt-get update"
        comment => "Update packages with new settings";
}

bundle agent provisioning_tools
{

  vars:
    "match_package" slist => { "ec2_api_tools" };

  packages:
    "$(match_package)"
      depends_on => { "enable_multiverse" },
      package_policy => "add",
      package_method => generic,
      action => log_repaired("stdout", "Package ${match_package} installed");

}

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to