<s> from kokki import Environment <EOL> def Host ( name , <EOL> alias = None , <EOL> address = None , <EOL> use = "<STR_LIT>" , <EOL> groups = [ ] , <EOL> action = "<STR_LIT>" , <EOL> ** kwargs ) : <EOL> env = Environment . get_instance ( ) <EOL> kwargs [ '<STR_LIT:name>' ] = name <EOL> kwargs [ '<STR_LIT>' ] = alias or name <EOL> kwargs [ '<STR_LIT:address>' ] = address or name <EOL> kwargs [ '<STR_LIT>' ] = use <EOL> kwargs [ '<STR_LIT>' ] = { } <EOL> kwargs [ '<STR_LIT>' ] = groups <EOL> if action == "<STR_LIT>" : <EOL> host = env . config . nagios3 . hosts . pop ( name , None ) <EOL> if host : <EOL> for g in host . get ( '<STR_LIT>' , [ ] ) : <EOL> env . config . nagios3 . hostgroups [ g ] [ '<STR_LIT>' ] . remove ( name ) <EOL> else : <EOL> env . config . nagios3 . hosts [ name ] = kwargs <EOL> for g in groups : <EOL> env . config . nagios3 . hostgroups [ g ] [ '<STR_LIT>' ] . append ( name ) </s>
