Create or update the definition of a docker-compose service
    This does not pull or up the service
    This wil re-write your yaml file. Comments will be lost. Indentation is set to 2 spaces

    path
        Path where the docker-compose file is stored on the server
    service_name
        Name of the service to create
    definition
        Service definition as yaml or json string

    CLI Example:

    .. code-block:: bash

        salt myminion dockercompose.service_upsert /path/where/docker-compose/stored service_name definition

def service_upsert(path, service_name, definition):
    '''
    Create or update the definition of a docker-compose service
    This does not pull or up the service
    This wil re-write your yaml file. Comments will be lost. Indentation is set to 2 spaces

    path
        Path where the docker-compose file is stored on the server
    service_name
        Name of the service to create
    definition
        Service definition as yaml or json string

    CLI Example:

    .. code-block:: bash

        salt myminion dockercompose.service_upsert /path/where/docker-compose/stored service_name definition
    '''
    compose_result, loaded_definition, err = __load_compose_definitions(path, definition)
    if err:
        return err
    services = compose_result['compose_content']['services']
    if service_name in services:
        msg = 'Service {0} already exists'.format(service_name)
        return __standardize_result(False, msg, None, None)
    services[service_name] = loaded_definition
    return __dump_compose_file(path, compose_result,
                               'Service definition for {0} is set'.format(service_name),
                               already_existed=True)