Exemple #1
0
def run_turbolift():
    """This is the run section of the application Turbolift."""

    if len(sys.argv) <= 1:
        arguments.get_help()
        raise SystemExit('Give me something to do and I will do it')
    else:
        args = arguments.get_args()
        log = logger.LogSetup(
            debug_logging=args.get('debug', False),
            log_dir=args.get('log_location', '/var/log'),
            log_name=args.get('log_file')
        ).default_logger(enable_stream=args.get('log_streaming'))

        log.debug('set arguments [ %s ]', json.dumps(args, indent=2))

        import turbolift.utils.basic_utils as basic
        args = basic.dict_pop_none(dictionary=args)
        load_constants(args=args)

        try:
            from turbolift import worker
            worker.start_work()
        except KeyboardInterrupt:
            turbo.emergency_kill(reclaim=True)
        finally:
            if args.get('quiet') is not True:
                print('All Done!')
            log.info('Job Finished.')
def run_turbolift():
    """This is the run section of the application Turbolift."""

    if len(sys.argv) <= 1:
        arguments.get_help()
        raise SystemExit('Give me something to do and I will do it')
    else:
        args = arguments.get_args()
        log = logger.load_in(log_level=args.get('log_level', 'info'),
                             log_location=args.get('log_location', '/var/log'))
        log.debug('set arguments %s', args)
        load_constants(log_method=log, args=args)
        try:
            from turbolift import worker
            worker.start_work()
        except KeyboardInterrupt:
            turbo.emergency_kill(reclaim=True)
        finally:
            print('All Done!')
Exemple #3
0
    "os_user": "******",  # Username
    "os_apikey": "YOURAPIKEY",  # API-Key
    "os_rax_auth": "YOURREGION",  # RAX Region, must be UPPERCASE
    "error_retry": 5,  # Number of failure retries
    "quiet": True,  # Make the application not print stdout
}


# Load our Logger
from turbolift.logger import logger

log_method = logger.load_in(log_level="info", log_file="turbolift_library", log_location=HOME)


# Load our constants
turbolift.load_constants(log_method, args)


# Authenticate against the swift API
from turbolift.authentication import auth

authentication = auth.authenticate()


# Package up the Payload
import turbolift.utils.http_utils as http

payload = http.prep_payload(auth=auth, container=args.get("container"), source=args.get("source"), args=args)


# Load all of our available cloud actions
args = turbolift.ARGS = {
    'os_user': '******',  # Username
    'os_apikey': 'YOURAPIKEY',  # API-Key
    'os_rax_auth': 'YOURREGION',  # RAX Region, must be UPPERCASE
    'error_retry': 5,  # Number of failure retries
    'quiet': True  # Make the application not print stdout
}

# Load our Logger
from turbolift.logger import logger
log_method = logger.load_in(log_level='info',
                            log_file='turbolift_library',
                            log_location=HOME)

# Load our constants
turbolift.load_constants(log_method, args)

# Authenticate against the swift API
from turbolift.authentication import auth
authentication = auth.authenticate()

# Package up the Payload
import turbolift.utils.http_utils as http
payload = http.prep_payload(auth=auth,
                            container=args.get('container'),
                            source=args.get('source'),
                            args=args)

# Load all of our available cloud actions
from turbolift.clouderator import actions
cf_actions = actions.CloudActions(payload=payload)