# Path: cloudify_agent/api/defaults.py
# START_TIMEOUT = 60
# START_INTERVAL = 1
# STOP_TIMEOUT = 60
# STOP_INTERVAL = 1
# INTERNAL_REST_PORT = 53333
# MIN_WORKERS = 0
# MAX_WORKERS = 5
# BROKER_URL = 'amqp://{username}:{password}@{host}:{port}/{vhost}'
# DELETE_AMQP_QUEUE_BEFORE_START = False
# DAEMON_FORCE_DELETE = False
# CLOUDIFY_AGENT_PREFIX = 'cfy-agent'
# LOG_LEVEL = 'info'
# LOG_FILE_SIZE = 5 * 1024 * 1024
# LOG_BACKUPS = 7
# SSL_CERTS_TARGET_DIR = 'cloudify/ssl'
# AGENT_SSL_CERT_FILENAME = 'cloudify_internal_cert.pem'
# DEFAULT_TENANT_NAME = 'default_tenant'


import uuid
import json
import copy
import tempfile
import os
import errno
import getpass
import pkgutil
import appdirs
import pkg_resources
import cloudify_agent
        import pwd
from jinja2 import Template
from cloudify._compat import urlquote, PY2
from cloudify.cluster import CloudifyClusterClient
from cloudify.workflows import tasks as workflows_tasks
from cloudify.utils import setup_logger, get_exec_tempdir, ipv6_url_compat
from cloudify.constants import (SECURED_PROTOCOL,
                                BROKER_PORT_SSL,
                                BROKER_PORT_NO_SSL)
from cloudify.utils import is_agent_alive  # noqa
from cloudify_agent.api import defaults
        """

        return os.environ[cls.CLOUDIFY_DAEMON_USER_KEY]

    @classmethod
    def get_storage_directory(cls, username=None):

        """
        Retrieve path to the directory where all daemon
        registered under a specific username will be stored.
        If no `username` is provided, username under which current daemon
        was installed will be used.

        :param username: the user

        """
        if cls.CLOUDIFY_DAEMON_STORAGE_DIRECTORY_KEY in os.environ:
            return cls.get_daemon_storage_dir()

        if os.name == 'nt':
            return appdirs.site_data_dir('cloudify-agent', 'Cloudify')

        if username is None and cls.CLOUDIFY_DAEMON_USER_KEY in os.environ:
            username = cls.get_daemon_user()
        return os.path.join(get_home_dir(username), '.cfy-agent')

    @staticmethod
    def generate_agent_name():
        """Generates a unique name with a pre-defined prefix
        """

# Path: cloudify_agent/api/defaults.py
# START_TIMEOUT = 60
# START_INTERVAL = 1
# STOP_TIMEOUT = 60
# STOP_INTERVAL = 1
# INTERNAL_REST_PORT = 53333
# MIN_WORKERS = 0
# MAX_WORKERS = 5
# BROKER_URL = 'amqp://{username}:{password}@{host}:{port}/{vhost}'
# DELETE_AMQP_QUEUE_BEFORE_START = False
# DAEMON_FORCE_DELETE = False
# CLOUDIFY_AGENT_PREFIX = 'cfy-agent'
# LOG_LEVEL = 'info'
# LOG_FILE_SIZE = 5 * 1024 * 1024
# LOG_BACKUPS = 7
# SSL_CERTS_TARGET_DIR = 'cloudify/ssl'
# AGENT_SSL_CERT_FILENAME = 'cloudify_internal_cert.pem'
# DEFAULT_TENANT_NAME = 'default_tenant'


# Path: cloudify_agent/api/utils.py
import uuid
import json
import copy
import tempfile
import os
import errno
import getpass
import pkgutil
import appdirs
import pkg_resources
import cloudify_agent
        import pwd
from jinja2 import Template
from cloudify._compat import urlquote, PY2
from cloudify.cluster import CloudifyClusterClient
from cloudify.workflows import tasks as workflows_tasks
from cloudify.utils import setup_logger, get_exec_tempdir, ipv6_url_compat
from cloudify.constants import (SECURED_PROTOCOL,
                                BROKER_PORT_SSL,
                                BROKER_PORT_NO_SSL)
from cloudify.utils import is_agent_alive  # noqa
from cloudify_agent.api import defaults

        """

        return os.environ[cls.CLOUDIFY_DAEMON_USER_KEY]

    @classmethod
    def get_storage_directory(cls, username=None):

        """
        Retrieve path to the directory where all daemon
        registered under a specific username will be stored.
        If no `username` is provided, username under which current daemon
        was installed will be used.

        :param username: the user

        """
        if cls.CLOUDIFY_DAEMON_STORAGE_DIRECTORY_KEY in os.environ:
            return cls.get_daemon_storage_dir()

        if os.name == 'nt':
            return appdirs.site_data_dir('cloudify-agent', 'Cloudify')

        if username is None and cls.CLOUDIFY_DAEMON_USER_KEY in os.environ:
            username = cls.get_daemon_user()
        return os.path.join(get_home_dir(username), '.cfy-agent')

    @staticmethod
    def generate_agent_name():
        """Generates a unique name with a pre-defined prefix
        """

        return '{0}-{1}'.format(defaults.CLOUDIFY_AGENT_PREFIX, uuid.uuid4())