[UTF-8]Jakub Viták writes:

> I am not sure how are classes handled precisely.

I am a total newbie myself, but this is my understanding so far.

There are "hard" classes and "soft" classes. A hard class is something 
cfengnie detects by itself such as hostname, ip and such things.

Soft classes are user defined and can be based on a number of things such as 
hostname and IP.

> Se there could be something similar like if-else with this method.

>From what I have seen so far classes are like 'if'. Not sure yet how to 
implement the 'else' part or if it possible.
  
> My question is - every time when promise declare new class or it resets it,
> the promises are run again? Or how it works?


So, a class is like an 'if', but it is a condition to check if a promise (or 
section of code rather) needs to run. Whether a promise is up to date or not 
is separate from classes.

Example.
Say you have a class to detect the OS so you copy one set of files for Linux 
and another for FreeBSD. You would have code like (pseudocode.. still 
learning syntax...)
Vars:

Linux::
File = /somepath/somefile

FreeBSD::
File = /someotherpath/somefile

Then when the promise is run the class will determine if the OS is linux of 
freebsd and set the right path to the file. Then the promise will check if 
the file is up to date after comparing to the proper file in the proper 
path.

Again this is what I understand so far and have not even setup my 
environment yet.. only have time to work on cfengine at nights and weekends 
(too much other work during the week) and only started to look at cfengine 
last weekend.
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to