Export an image description for Kiwi.

    Parameters:

    * **local**: Specifies True or False if the export has to be in the local file. Default: False.
    * **path**: If `local=True`, then specifies the path where file with the Kiwi description is written.
                Default: `/tmp`.

    CLI Example:

    .. code-block:: bash

        salt myminion inspector.export
        salt myminion inspector.export format=iso path=/opt/builds/

def export(local=False, path="/tmp", format='qcow2'):
    '''
    Export an image description for Kiwi.

    Parameters:

    * **local**: Specifies True or False if the export has to be in the local file. Default: False.
    * **path**: If `local=True`, then specifies the path where file with the Kiwi description is written.
                Default: `/tmp`.

    CLI Example:

    .. code-block:: bash

        salt myminion inspector.export
        salt myminion inspector.export format=iso path=/opt/builds/
    '''
    if getpass.getuser() != 'root':
        raise CommandExecutionError('In order to export system, the minion should run as "root".')
    try:
        description = _("query").Query('all', cachedir=__opts__['cachedir'])()
        return _("collector").Inspector().reuse_snapshot().export(description, local=local, path=path, format=format)
    except InspectorKiwiProcessorException as ex:
        raise CommandExecutionError(ex)
    except Exception as ex:
        log.error(_get_error_message(ex))
        raise Exception(ex)