Exemplo n.º 1
0
def main():
    '''
    Description:
        This script will be used on EC2 for configuring the running
        instance based on Cloud Engine configuration supplied at
        launch time in the user data.

        Config Server Status:
        200 HTTP OK - Success and no more data of this type
        202 HTTP Accepted - Success and more data of this type
        404 HTTP Not Found - This may be temporary so try again
    '''
    # parse the args and setup logging
    conf = parse_args()
    log_file = {}
    if 'pwd' in conf and conf.pwd:
        log_file = {'logfile_name': 'audrey.log'}

    logger = setup_logging(level=conf.log_level, **log_file)

    if not conf.endpoint:
        # discover the cloud I'm on
        # update the conf with the user data
        #conf = dict(vars(conf).items() + user_data.discover().read().items())
        vars(conf).update(user_data.discover().read().items())

    # ensure the conf is a dictionary, not a namespace
    if hasattr(conf, '__dict__'):
        conf = vars(conf)

    logger.info('Invoked audrey main')

    # Create the Client Object and test connectivity
    # to CS by negotiating the api version
    client = CSClient(**conf)
    client.test_connection()

    # Get the agent object
    agent = AudreyFactory(client.api_version).agent
    # run the agent
    agent(conf).run()
Exemplo n.º 2
0
 def setUp(self):
     self.tool_dir = os.path.join(os.path.abspath('.'), 'test_tooling')
     self.tooling = Tooling(TARFILE, self.tool_dir)
     self.factory = AudreyFactory(1)
Exemplo n.º 3
0
 def setUp(self):
     self.factory = AudreyFactory(1)
     self.tooling = self.factory.tooling(TARFILE, TOOLING_DIR)
     self.service = self.factory.service('test_service', self.tooling)
Exemplo n.º 4
0
 def setUp(self):
     super(TestAudreyAgentToolingV2, self).setUp()
     self.factory = AudreyFactory(2)
Exemplo n.º 5
0
 def setUp(self):
     self.factory = AudreyFactory(1)
     self.tooling = self.factory.tooling(TARFILE, TOOLING_DIR)