Skip to content

Commit

Permalink
undocumented changes
Browse files Browse the repository at this point in the history
  • Loading branch information
srault95 committed Apr 28, 2020
1 parent 48fea96 commit ad33fa9
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
data/
.coverage
coverage.xml
.eggs/
*.egg-info
.env*
*.pid
Expand Down
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ before_install:
- python -m pip install --upgrade pip

install:
- pip install -e .[tests,dev]
- pip install -U coveralls
- pip install -U codecov
- pip install -e .[tests,ci]
- pip freeze

script:
- pytest -m 'not mce_todo' -x
Expand Down
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Multi-Cloud-Explorer - VMware (Vsphere)
# Multi-Cloud-Explorer - VMware (Vsphere)

Inventory library for VMware (Vsphere Release)

Expand All @@ -8,15 +8,16 @@ Inventory library for VMware (Vsphere Release)
[![codecov](https://codecov.io/gh/multi-cloud-explorer/mce-lib-vsphere/branch/master/graph/badge.svg)](https://codecov.io/gh/multi-cloud-explorer/mce-lib-vsphere)
[![Code Health](https://landscape.io/github/multi-cloud-explorer/mce-lib-vsphere/master/landscape.svg?style=flat)](https://landscape.io/github/multi-cloud-explorer/mce-lib-vsphere/master)
[![Requirements Status](https://requires.io/github/multi-cloud-explorer/mce-lib-vsphere/requirements.svg?branch=master)](https://requires.io/github/multi-cloud-explorer/mce-lib-vsphere/requirements/?branch=master)
[![Documentation Status](https://readthedocs.org/projects/mce-lib-vpshere/badge/?version=latest&style=flat-square)](https://mce-lib-vpshere.readthedocs.org)

[Documentation](https://multi-cloud-explorer.readthedocs.org)
**Inventory library for VMware (Vsphere Release)**

### Features

- [X] List all datacenters
- [X] List all clusters
- [X] List all datastores
- [X] List all virtual machines
- [X] List all Datacenter
- [X] List all Cluster
- [X] List all Datastores
- [X] List all Virtual Machines
- [ ] Command line client

### Installation
Expand Down Expand Up @@ -123,3 +124,13 @@ def test_get_all_vms(vsphere_server, vcsim_settings):
- [ ] Terraform templates ou Pulumi code for IAC
- [ ] Contrib doc

### Similar Python Projects

- [pyVirtualize](https://github.com/rocky1109/pyVirtualize)
- [vcdriver](https://github.com/Osirium/vcdriver)
- [py-vpoller](https://github.com/dnaeon/py-vpoller)
- [py-vconnector](https://github.com/dnaeon/py-vconnector)
- [ezmomi](https://github.com/snobear/ezmomi)
- [vcdriver](https://github.com/Lantero/vcdriver)
- [shortmomi](https://github.com/pschmitt/shortmomi)

6 changes: 0 additions & 6 deletions mce_lib_vsphere/cli.py

This file was deleted.

30 changes: 28 additions & 2 deletions mce_lib_vsphere/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re
import json
from typing import List, Tuple, Any, Mapping, Union
from enum import IntEnum, unique
from enum import Enum, IntEnum, unique

import typic
from decouple import config
Expand All @@ -25,6 +25,32 @@

VCENTER_URL = config('MCE_VCENTER_URL', 'https://user1:pass@127.0.0.1:8989/sdk?timeout=120')

@unique
class ResourceTypes(str, Enum):
DATACENTER = "vmware/Datacenter"
VIRTUAL_APP = "vmware/VirtualApp"
CLUSTER_COMPUTE_RESOURCE = "vmware/ClusterComputeResource"
FOLDER = "vmware/Folder"
DISTRIBUTED_VIRTUAL_PORTGROUP = "vmware/DistributedVirtualPortgroup"
HOST_SYSTEM = "vmware/HostSystem"
VIRTUAL_MACHINE = "vmware/VirtualMachine"
NETWORK = "vmware/Network"
OPAQUE_NETWORK = "vmware/OpaqueNetwork"
RESOURCE_POOL = "vmware/ResourcePool"
COMPUTE_RESOURCE = "vmware/ComputeResource" # ESX ?
DATASTORE = "vmware/Datastore"
DISTRIBUTED_VIRTUAL_SWITCH = "vmware/DistributedVirtualSwitch"

@classmethod
def to_choices(cls):
return [(e.value, e.name) for e in cls]

@classmethod
def to_dict(cls, reverse=False):
if reverse:
return {e.value: e.name for e in cls}
return {e.name: e.value for e in cls}

@unique
class EffectiveRoles(IntEnum):
ADMINISTRATOR = -1
Expand All @@ -34,7 +60,7 @@ class EffectiveRoles(IntEnum):
NO_ACCESS = -5

@classmethod
def to_choices(cls, reverse=False):
def to_choices(cls):
return [(e.value, e.name) for e in cls]

@classmethod
Expand Down
118 changes: 118 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
attrs==19.3.0
certifi==2020.4.5.1
cffi==1.14.0
chardet==3.0.4
click==7.1.2
cryptography==2.9.2
furl==2.1.0
idna==2.9
importlib-metadata==1.6.0
inflection==0.3.1
more-itertools==8.2.0
orderedmultidict==1.0.1
packaging==20.3
pendulum==2.1.0
pluggy==0.13.1
py==1.8.1
pycparser==2.20
pyOpenSSL==19.1.0
pyparsing==2.4.7
pytest==5.4.1
python-dateutil==2.8.1
python-decouple==3.3
pytzdata==2019.3
pyvmomi==7.0
requests==2.23.0
six==1.14.0
typical==2.0.5
typing-extensions==3.7.4.2
urllib3==1.25.9
wcwidth==0.1.9
zipp==3.1.0

# tests
apipkg==1.5
appdirs==1.4.3
bandit==1.6.2
black==19.10b0
coverage==5.1
entrypoints==0.3
execnet==1.7.1
flake8==3.7.9
freezegun==0.3.15
gitdb==4.0.4
GitPython==3.1.1
mccabe==0.6.1
pathspec==0.8.0
pbr==5.4.5
pep8==1.7.1
pycodestyle==2.5.0
pyflakes==2.1.1
pytest-cache==1.0
pytest-cov==2.8.1
pytest-flake8==1.0.5
pytest-pep8==1.0.6
PyYAML==5.3.1
regex==2020.4.4
smmap==3.0.2
stevedore==1.32.0
toml==0.10.0
typed-ast==1.4.1

# dev
astroid==2.4.0
autopep8==1.5.2
backcall==0.1.0
bleach==3.1.4
decorator==4.4.2
docutils==0.16
ipython==7.13.0
ipython-genutils==0.2.0
isort==4.3.21
jedi==0.17.0
jeepney==0.4.3
keyring==21.2.0
lazy-object-proxy==1.4.3
parso==0.7.0
pexpect==4.8.0
pickleshare==0.7.5
pkginfo==1.5.0.1
prompt-toolkit==3.0.5
ptyprocess==0.6.0
Pygments==2.6.1
pylint==2.5.0
readme-renderer==26.0
requests-toolbelt==0.9.1
SecretStorage==3.1.2
tqdm==4.45.0
traitlets==4.3.3
twine==3.1.1
webencodings==0.5.1
wrapt==1.12.1

# doc

alabaster==0.7.12
Babel==2.8.0
imagesize==1.2.0
Jinja2==2.11.2
MarkupSafe==1.1.1
pytz==2019.3
snowballstemmer==2.0.0
Sphinx==3.0.3
sphinx-autodoc-typehints==1.10.3
sphinx-click==2.3.2
sphinx-rtd-theme==0.4.3
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4

# ci

codecov==2.0.22
coveralls==2.0.0
docopt==0.6.2

12 changes: 11 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ addopts = -p no:warnings --strict-markers --cov=mce_lib_vsphere --cov-branch

[coverage:run]
source = mce_lib_vsphere
omit =
mce_lib_vsphere/pytest/*
mce_lib_vsphere/_version.py

[coverage:report]
show_missing = true
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
Expand All @@ -26,3 +28,11 @@ exclude_lines =
[flake8]
max-line-length = 127

[versioneer]
VCS = git
style = pep440
versionfile_source = mce_lib_vsphere/_version.py
versionfile_build = mce_lib_vsphere/_version.py
tag_prefix =
parentdir_prefix = mce-lib-vsphere-

14 changes: 12 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
from setuptools import setup, find_packages

import versioneer

install_requires = [
'requests[security]>=2.23.0,<3',
'pyvmomi>=6.5,<=7',
Expand Down Expand Up @@ -33,16 +35,22 @@
]

doc_requires = [
'Sphinx',
'Sphinx>=3.0',
'sphinx_rtd_theme',
'sphinx-click',
'sphinx-autodoc-typehints'
]

ci_requires = [
'coveralls',
'codecov',
]

extras_requires = {
'tests': tests_requires,
'dev': dev_requires,
'doc': doc_requires,
'ci': ci_requires
}

here = os.path.abspath(os.path.dirname(__file__))
Expand All @@ -52,13 +60,15 @@

setup(
name='mce-lib-vsphere',
version="0.1.0",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='Inventory library for VMware (Vsphere Release)',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/multi-cloud-explorer/mce-lib-vsphere.git',
packages=find_packages(exclude=("tests",)),
include_package_data=True,
setup_requires=["pytest-runner"],
tests_require=tests_requires,
install_requires=install_requires,
extras_require=extras_requires,
Expand Down

0 comments on commit ad33fa9

Please sign in to comment.