Skip to content

Commit

Permalink
Merge pull request #8 from devopshq/develop
Browse files Browse the repository at this point in the history
Preparing for release 1.0
  • Loading branch information
Tim55667757 committed Jul 11, 2017
2 parents ed769dc + 833b8e2 commit 9aa3d4c
Show file tree
Hide file tree
Showing 18 changed files with 1,247 additions and 470 deletions.
97 changes: 97 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
.idea/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
language: python
python: '2.7'
branches:
only:
- master
- develop
install:
- pip install pytest coverage codacy-coverage
script:
- printenv
- ls -la
- coverage run -m py.test tests
- coverage xml
- python-codacy-coverage -r coverage.xml
deploy:
provider: pypi
user: devopshq
password:
secure: "KBNBXu5h38LnDbQkjr0+2FqpU27Y0cwNjtG0x44tnsxQQOgnidU5r3khjqe7cpiOAySlU0yOarSH1Py7IJiRK2XpdYgRz6ZdM29nq9uJvdyQ9jNNgWAoXMl2olWRe5I2IcAvTQ8Dc5j8EmWmds2GuPFrSh3HAVjZXv4yGkY4bXsXlp1SHPTzJUbHQBntKQJLBVV6/jgCAJ6drHQLKSIx4zWaxub3OmePPC0/y4R4Qj/O+sfGMTdOnrNnNkzjEhAo3sxHn1lWlwit4Is6m7J5dA5m7G6jNNDqVJ+r+2b+q575NXKbSqurRqkVHiw7BplkD4vcImRlSilfI83cHyKA2j5qprI6jFakkjyu79zOaa7HuDnWBPbdIpT69F0de9iRPtdlivEyfo0Kmtg0VGUaJkb52QMO5SkdU7XpVRKzSIDvyUFwN7igsUoe052yISILpOk3Y5qjZq+Fsx7XgeZmF8tLGTdsHJIHFLwFHrQbozF9SEMEtuRFzpAGxwavmvgRcCAuR7HPfQxywE0a9dZyF4odGg8QwoCNzwVl5qsQFagCJ9RjDngTf3bcHcwaV35tIHxdmXijkdY1+d2vP7hu+b0EnMELSOTiYcjsmgBK3Mn45WzOoq/gCJdZ1AKjRdDylmcDLo7ddKvTpAgeZux/2r3MQ6tMLGH4bHcJcsA9XYc="
distributions: bdist_wheel
on:
all_branches: true
skip_cleanup: true
after_script:
- echo "Deploy to PyPI finished."
env:
global:
- secure: "laINM+2dOwjZe1pw5pzt1f4L3Pqtd867taoFV+XSlqtxe1onyZje7x1iVbslmNdCTeo62Lidx9z9I3Vwv9dDBkjEfGwyUHHHz+kRwJ4zJbCQ4HzYQ6auIjP7MuyKsl6bysnKAdrjo/OtPX1a6iKKaIOv1RoDD4FQldps5Chl6GLJjbpsQPHn07vj2XvcDQcMQH0AFBxIROAxQir1Ox01LLsC2DxiCxQ4QxosLBjv0Gat1h7bT7bKu74qV+OPo5VNPg/H4/u+fIirx8V6r0HHXsoFEhlyYkKSvAfYljyZREUwI8cuu1Q463CBstHH4IokEDzhZO0hJrgLPYnNJyNhgfc3BEgRAiCVOplWBXjvk5k+Fi8NeogvbS4dNExt6am1sy9iKml2p34aErVgh5RVFYrezAJlUPDTcGSOW6eXUfl62ORDbvXth48lbbzxqOi9iTu6UduImTAKuyK0rnQcRTSfRHKqoo/Ptc+p5tJoAU/NKoaJRmYdC0taXJCLWFZqZl7n/ERaknUFBmmmBunmgQ38t3T1Qt9UMdzYshxNSoonTNJELlcRlRZLrZAl0w0BW1SNkB636yku2s9a0gidi25JK+Hx0Mquax0Y+I0bKhxiwVFI/2bCZQyJxGVRzm/elsQzFmIiUBbB4mcfdJpxeZ/2SdVPiPT0pwqY7oVLOks="
443 changes: 234 additions & 209 deletions README.md

Large diffs are not rendered by default.

320 changes: 320 additions & 0 deletions README_RUS.md

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions pysphere/resources/vi_exception.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#--
# Copyright (c) 2012, Sebastian Tello
# All rights reserved.

Expand All @@ -24,13 +23,13 @@
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#--


class VIException(Exception):
def __init__(self, msg, fault):
self.message = str(msg)
self.fault = str(fault)

def __str__(self):
return "[%s]: %s" % (self.fault, self.message)

Expand All @@ -39,23 +38,28 @@ class VIApiException(VIException):
def __init__(self, e):
try:
message = e.fault.args[1]
except:
message = str(e)

except Exception as eX:
message = str(eX)

try:
fault = e.fault.detail[0].typecode.pname

except:
fault = 'Undefined'

super(self.__class__, self).__init__(message, fault)


class UnsupportedPerfIntervalError(VIException):
pass


class FaultTypes:
PARAMETER_ERROR = 'Parameter Error'
OBJECT_NOT_FOUND = 'Object Not Found'
NOT_CONNECTED = 'Not Connected'
TIME_OUT = 'Operation Timed Out'
TASK_ERROR = 'Task Error'
NOT_SUPPORTED = 'Operation Not Supported'
INVALID_OPERATION = 'Invalid Operation'
PARAMETER_ERROR = 'Parameter Error'
OBJECT_NOT_FOUND = 'Object Not Found'
NOT_CONNECTED = 'Not Connected'
TIME_OUT = 'Operation Timed Out'
TASK_ERROR = 'Task Error'
NOT_SUPPORTED = 'Operation Not Supported'
INVALID_OPERATION = 'Invalid Operation'
19 changes: 9 additions & 10 deletions pysphere/vi_managed_entity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#--
# Copyright (c) 2012, Sebastian Tello
# All rights reserved.

Expand All @@ -24,13 +23,12 @@
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#--


from pysphere.resources import VimService_services as VI
from pysphere.vi_task import VITask
from pysphere.resources.vi_exception import VIException, VIApiException, \
FaultTypes
from pysphere.resources.vi_exception import VIException, VIApiException, FaultTypes


class VIManagedEntity(object):

Expand Down Expand Up @@ -69,7 +67,7 @@ def rename(self, new_name, sync_run=True):

return vi_task

except (VI.ZSI.FaultException), e:
except VI.ZSI.FaultException as e:
raise VIApiException(e)

def reload(self):
Expand All @@ -90,7 +88,8 @@ def reload(self):
_this.set_attribute_type(self._mor.get_attribute_type())
request.set_element__this(_this)
self._server._proxy.Reload(request)
except (VI.ZSI.FaultException), e:

except VI.ZSI.FaultException as e:
raise VIApiException(e)

def destroy(self, sync_run=True):
Expand All @@ -106,7 +105,6 @@ def destroy(self, sync_run=True):
_this = request.new__this(self._mor)
_this.set_attribute_type(self._mor.get_attribute_type())
request.set_element__this(_this)


task = self._server._proxy.Destroy_Task(request)._returnval
vi_task = VITask(task, self._server)
Expand All @@ -119,5 +117,6 @@ def destroy(self, sync_run=True):
return

return vi_task
except (VI.ZSI.FaultException), e:
raise VIApiException(e)

except VI.ZSI.FaultException as e:
raise VIApiException(e)
Loading

0 comments on commit 9aa3d4c

Please sign in to comment.