Forum: CFEngine Help
Subject: Avoid warning if file does not exist
Author: loopx
Link to topic: https://cfengine.com/forum/read.php?3,26654,26654#msg-26654

Hi, 


I've done this promise :

                "location_nic_default_configuration"
                        string          => "/etc/sysconfig/network-scripts",
                        comment         => "The location of default NIC 
configuration scripts";


                "nic_default"
                        slist           => {
                                "eth0",
                                "eth1",
                                "bond0"
                        },
                        comment         => "Define default used NIC at ONEmRVA";


                        
"$(g.location_nic_default_configuration)/ifcfg-$(g.nic_default)"
                                edit_line       => 
comment_lines_matching("DNS(1|2)=.*", "#"),
                                comment         => "Disable DNS configuration 
from network-scripts (use '/etc/resolv.conf' instead)";


which is working fine. But, with cf-agent -I, it shows :

R: Promises have been updated!
 -> Edited file /etc/sysconfig/network-scripts/ifcfg-eth0
File /etc/sysconfig/network-scripts/ifcfg-eth1 was marked for editing but could 
not be opened
I: Report relates to a promise with handle ""
I: Made in version 'Community Promises.cf 1.0.0 / ONEmRVA' of 
'/var/cfengine/inputs/onemrva/default.cf' near line 94
I: Comment: Disable DNS configuration from network-scripts (use 
'/etc/resolv.conf' instead)

File /etc/sysconfig/network-scripts/ifcfg-bond0 was marked for editing but 
could not be opened
I: Report relates to a promise with handle ""
I: Made in version 'Community Promises.cf 1.0.0 / ONEmRVA' of 
'/var/cfengine/inputs/onemrva/default.cf' near line 94
I: Comment: Disable DNS configuration from network-scripts (use 
'/etc/resolv.conf' instead)

... and I don't like these warnings since they are useless because if file 
doesn't exist, nothing should happend.

How can I fix that ? With classes ? Is that the good way ?


Thanks

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

Reply via email to