from ..shinkenconfig import ConfigObject

def generate_host_config(config, project_name, instance):
    co = ConfigObject('host')
    co.properties['use'] = 'generic-host'
    co.properties['host_name'] = instance['name']
    co.properties['address'] = instance['ip'][0]
    projects = [project_name, config.get('default-hostgroup', 'labshost')]
    co.properties['hostgroups'] = ','.join(projects)
    co.properties['contact_groups'] = project_name
    return co

from ..shinkenconfig import ConfigObject

def generate_host_config(config, project_name, instance):
    co = ConfigObject('host')
    co.properties['use'] = 'generic-host'
    co.properties['host_name'] = instance['name']
    co.properties['address'] = instance['ip'][0]
    projects = [project_name, config.get('default-hostgroup', 'labshost')]
    co.properties['hostgroups'] = ','.join(projects)
    co.properties['contact_groups'] = project_name
    co.properties['notes'] = project_name # Used for auto deriving graphite path
    return co

Put project name in 'notes' field of host
Put project name in 'notes' field of host

Labs' graphite metrics architecture means we need both the
project name and the hostname to find a full path to our
host. Abusing this field for that purpose.

Change-Id: If097526f413f36407acdff852cc81216f9c84556
