Hello, To achieve this I have provided my modified version of package_method body: body package_method aptget { package_changes => "bulk"; package_list_command => "/usr/bin/dpkg -l"; package_list_name_regex => "ii\s+([^\s]+).*"; package_list_version_regex => "ii\s+[^\s]+\s+([^\s]+).*"; package_installed_regex => ".*"; # all reported are installed package_name_convention => "$(name)"; package_add_command => "/usr/bin/env DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get --yes install"; package_delete_command => "/usr/bin/apt-get --yes remove"; package_update_command => "/usr/bin/env DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get --yes install"; package_list_update_command => "/usr/bin/apt-get update"; package_verify_command => "/usr/bin/dpkg -s"; package_noverify_returncode => "1";
!package_list_update_needed_now:: package_list_update_ifelapsed => "1440"; # 24 hours #this should not be needed as is the default behaviour. #package_list_update_needed_now:: # package_list_update_ifelapsed => "0"; # update now! } Then I set the class "package_list_update_needed_now" only if there was a change to the list file. For example: "/etc/apt/sources.list.d/ubuntu.list" comment => "Generate the ubuntu sources.list file", handle => "packages_files_apt_ubuntu_list", create => "true", edit_line => expand_template("$(v.cfrepo)/packages/ubuntu.list.tmplt"), edit_defaults => empty, perms => mog("0644","root","root"), classes => if_repaired("package_list_update_needed_now"); When there is a change to the list file, apt-get update will be triggered immediately. Otherwise, it will be only run once a day (each 1440 minutes). Best regards, Bolesław Tokarski _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine