Skip to content

Commit

Permalink
Merge pull request #604 from QualiSystems/feature/roni_update_logger_ref
Browse files Browse the repository at this point in the history
update logger and update travis
  • Loading branch information
doppleware committed Mar 30, 2016
2 parents 164bb99 + d0b5b45 commit 08d6477
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ python:
- "2.7"

install:
- pip install -r package/requirements.txt
- pip install cloudshell-shell-core
- pip install -r package/requirements.txt --extra-index-url https://testpypi.python.org/pypi
- pip install cloudshell-shell-core --extra-index-url https://testpypi.python.org/pypi
- pip install -r test_requirements.txt
- pip install coveralls

Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
[![Build Status](https://travis-ci.org/QualiSystems/vCenterShell.svg?branch=master)](https://travis-ci.org/QualiSystems/vCenterShell) [![Coverage Status](https://coveralls.io/repos/QualiSystems/vCenterShell/badge.svg?branch=develop&service=github)](https://coveralls.io/github/QualiSystems/vCenterShell?branch=develop) [![Code Climate](https://codeclimate.com/github/QualiSystems/vCenterShell/badges/gpa.svg)](https://codeclimate.com/github/QualiSystems/vCenterShell) [ ![Foo](https://qualisystems.getbadges.io/shield/company/qualisystems) ](https://getbadges.io) [![Stories in Ready](https://badge.waffle.io/QualiSystems/vCenterShell.svg?label=ready&title=Ready)](http://waffle.io/QualiSystems/vCenterShell) [![Join the chat at https://gitter.im/QualiSystems/vCenterShell](https://badges.gitter.im/QualiSystems/vCenterShell.svg)](https://gitter.im/QualiSystems/vCenterShell?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Analytics](https://ga-beacon.appspot.com/UA-72194260-1/QualiSystems/vCenterShell)](https://github.com/QualiSystems/vCenterShell/)

A lightweight CloudShell 'shell' that allows integrating with vCenter as an app deployment option.
A repository for projects providing out of the box capabilities within CloudShell to define VMWare vCenter instances in CloudShell and leverage vCenter's capabilities to deploy and connect apps in CloudShell sandboxes.

## Requirements
## Projects
* **Deployment Drivers**

These projects extend CloudShell apps with new deployment types
* **deploy_from_image**
App deployment type driver for deploying from vCenter OVF images
* **deploy_from_template**
App deployment type driver for cloning from vCenter templates


* **package**

The vCenter Python package hosted in [PyPi](https://pypi.python.org/). The package contains most of the logic relate
to working with the vCenter API.

* **vcentershell_driver**

The CloudShell driver for controlling vCenter via CloudShell.

## Installation
* [QualiSystems CloudShell 7.0](http://www.qualisystems.com/products/cloudshell/cloudshell-overview/)
* [pyvmomi 6.0](https://github.com/vmware/pyvmomi)
* [jsonpickle latest](https://jsonpickle.github.io/)


## Getting Started

1. Download vCenterShell.zip from Releases page
Expand Down
4 changes: 3 additions & 1 deletion environment_scripts/env_setup/setup_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class EnvironmentSetup(object):

def __init__(self):
self.reservation_id = helpers.get_reservation_context_details().id
self.logger = qs_logger.get_qs_logger(name="CloudShell Sandbox Setup", reservation_id=self.reservation_id)
self.logger = qs_logger.get_qs_logger(log_file_prefix="CloudShell Sandbox Setup",
log_group=self.reservation_id,
log_category='Setup')

@profileit(scriptName='Setup')
def execute(self):
Expand Down
4 changes: 3 additions & 1 deletion environment_scripts/env_teardown/teardown_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
class EnvironmentTeardown:
def __init__(self):
self.reservation_id = helpers.get_reservation_context_details().id
self.logger = qs_logger.get_qs_logger(name="CloudShell Sandbox Teardown", reservation_id=self.reservation_id)
self.logger = qs_logger.get_qs_logger(log_file_prefix="CloudShell Sandbox Teardown",
log_group=self.reservation_id,
log_category='Teardown')

@profileit(scriptName="Teardown")
def execute(self):
Expand Down
8 changes: 4 additions & 4 deletions orchestration_service/context_based_logger_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def create_logger_for_context(self, logger_name, context):
:param logger_name:
:type logger_name: str
:param context:
:return:
:return: logging.Logger
"""
if self._is_instance_of(context, 'AutoLoadCommandContext'):
reservation_id = 'Autoload'
Expand All @@ -23,9 +23,9 @@ def create_logger_for_context(self, logger_name, context):
handler_name = context.remote_endpoints[0].name
else:
raise Exception(ContextBasedLoggerFactory.UNSUPPORTED_CONTEXT_PROVIDED, context)
logger = get_qs_logger(name=logger_name,
handler_name=handler_name,
reservation_id=reservation_id)
logger = get_qs_logger(log_file_prefix=handler_name,
log_group=reservation_id,
log_category=logger_name)
return logger

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion orchestration_service/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self):
def deploy(self, context):
"""
Deploys app from template
:type context: cloudshell.shell.core.driver_context.ResourceCommandContext
:type context: cloudshell.shell.core.context.ResourceCommandContext
"""
logger = self.context_based_logger_factory.create_logger_for_context(
logger_name='DeployAppOrchestrationDriver',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def create_logger_for_context(self, logger_name, context):
handler_name = context.remote_endpoints[0].name
else:
raise Exception(ContextBasedLoggerFactory.UNSUPPORTED_CONTEXT_PROVIDED, context)
logger = get_qs_logger(name=logger_name,
handler_name=handler_name,
reservation_id=reservation_id)
logger = get_qs_logger(log_file_prefix=handler_name,
log_group=reservation_id,
log_category=logger_name)
return logger

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def execute_command_with_connection(self, context, command, *args):
Note: session & vcenter_data_model objects will be injected dynamically to the command
:param command:
:param context: instance of ResourceCommandContext or AutoLoadCommandContext
:type context: cloudshell.shell.core.driver_context.ResourceCommandContext
:type context: cloudshell.shell.core.context.ResourceCommandContext
:param args:
"""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from unittest import TestCase
from cloudshell.shell.core.driver_context import ResourceCommandContext, \
from cloudshell.shell.core.context import ResourceCommandContext, \
ReservationContextDetails, ResourceContextDetails, ConnectivityContext
from mock import Mock, create_autospec

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pyVmomi import vim
from cloudshell.cp.vcenter.common.vcenter.vmomi_service import pyVmomiService
from cloudshell.tests.utils.testing_credentials import TestCredentials
logger = get_qs_logger()


class TestVmomiService(unittest.TestCase):
Expand All @@ -34,7 +33,6 @@ def integration_clone_vm_destory(self):
now = datetime.now()
res = pv_service.clone_vm(clone_params=params,
logger=Mock())
logger.debug('clone took: %s' % (str(datetime.now() - now)))

'#assert'
self.assertTrue(type(res.vm), vim.VirtualMachine)
Expand Down
4 changes: 3 additions & 1 deletion vlan_service_scripts/connect/connect_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
class ConnectAll:
def __init__(self):
self.reservation_id = helpers.get_reservation_context_details().id
self.logger = qs_logger.get_qs_logger(name="Connect All", reservation_id=self.reservation_id)
self.logger = qs_logger.get_qs_logger(log_file_prefix='Connect_All',
log_group=self.reservation_id,
log_category="Connect All")

def execute(self):
api = helpers.get_api_session()
Expand Down

0 comments on commit 08d6477

Please sign in to comment.