# Path: neckbeard/actions/utils.py
# def get_deployer():
#     return os.environ.get(
#         'POLICYSTAT_DEPLOYER_NAME',
#         os.environ.get('USER', 'unknown'),
#     )
# 
# def _get_gen_target():
#     generation_target = ''
#     if hasattr(env, '_active_gen'):
#         if env._active_gen:
#             generation_target = 'ACTIVE'
#         else:
#             if getattr(env, '_old_gen', False):
#                 generation_target = 'OLD'
#             else:
#                 generation_target = 'PENDING'
#     else:
#         logger.critical("Must run active, pending or old before this task")
#         exit(1)
# 
#     return generation_target


import httplib
import urllib
import json
import logging
import requests
    import git
    import pynotify
from datetime import datetime, timedelta
from fabric.api import env, local, sudo
from decorator import contextmanager
from requests.exceptions import RequestException
from neckbeard.actions.utils import get_deployer, _get_gen_target
    """
    # Ensure we have the required configs
    hipchat_conf = {}
    for key in ['api_token', 'room']:
        hipchat_conf[key] = env.get('hipchat_%s' % key, None)
    for key, value in hipchat_conf.items():
        if value is None:
            logger.warning(
                "No hipchat_%s found. Not notifying.",
                key,
            )
            yield
            logger.warning(
                "No hipchat_%s found. Not notifying.",
                key,
            )
            return
    hipchat_conf['color'] = env.get('hipchat_color', 'green')
    hipchat_conf['from'] = env.get('hipchat_from', 'Neckbeard')

    # Get our git branchname. Fallback to a SHA if detached head
    r = git.Repo('.')
    branch_name = r.commit().hexsha[:7]
    if not r.head.is_detached:
        branch_name = r.active_branch.name

    # Build the message
    context = {
        'deployer': get_deployer(),
        'deployment_name': env.get('_deployment_name', 'unknown'),

# Path: neckbeard/actions/utils.py
# def get_deployer():
#     return os.environ.get(
#         'POLICYSTAT_DEPLOYER_NAME',
#         os.environ.get('USER', 'unknown'),
#     )
# 
# def _get_gen_target():
#     generation_target = ''
#     if hasattr(env, '_active_gen'):
#         if env._active_gen:
#             generation_target = 'ACTIVE'
#         else:
#             if getattr(env, '_old_gen', False):
#                 generation_target = 'OLD'
#             else:
#                 generation_target = 'PENDING'
#     else:
#         logger.critical("Must run active, pending or old before this task")
#         exit(1)
# 
#     return generation_target


# Path: neckbeard/actions/contrib_hooks.py
import httplib
import urllib
import json
import logging
import requests
    import git
    import pynotify
from datetime import datetime, timedelta
from fabric.api import env, local, sudo
from decorator import contextmanager
from requests.exceptions import RequestException
from neckbeard.actions.utils import get_deployer, _get_gen_target

    """
    # Ensure we have the required configs
    hipchat_conf = {}
    for key in ['api_token', 'room']:
        hipchat_conf[key] = env.get('hipchat_%s' % key, None)
    for key, value in hipchat_conf.items():
        if value is None:
            logger.warning(
                "No hipchat_%s found. Not notifying.",
                key,
            )
            yield
            logger.warning(
                "No hipchat_%s found. Not notifying.",
                key,
            )
            return
    hipchat_conf['color'] = env.get('hipchat_color', 'green')
    hipchat_conf['from'] = env.get('hipchat_from', 'Neckbeard')

    # Get our git branchname. Fallback to a SHA if detached head
    r = git.Repo('.')
    branch_name = r.commit().hexsha[:7]
    if not r.head.is_detached:
        branch_name = r.active_branch.name

    # Build the message
    context = {
        'deployer': get_deployer(),
        'deployment_name': env.get('_deployment_name', 'unknown'),

        'generation': _get_gen_target().lower(),