-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a fake cmd to print out static capacity.
- Loading branch information
1 parent
5a94ccb
commit 395cbc6
Showing
22 changed files
with
397 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,3 +99,7 @@ ENV/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# vim | ||
*.swp | ||
*.swo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
os-capacity does not currently follow the upstream OpenStack development | ||
process, but we will still be incredibly grateful for any contributions. | ||
|
||
Please raise issues and submit pull requests via Github. | ||
|
||
Thanks in advance! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# os-capacity-probe | ||
os-capacity | ||
=========== | ||
|
||
Find out how much capacity you have in your OpenStack cloud. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Copyright (c) 2017 StackHPC Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# -*- coding: utf-8 -*- | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||
# implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath('../..')) | ||
# -- General configuration ---------------------------------------------------- | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. | ||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
#'sphinx.ext.intersphinx', | ||
# Uncomment this to enable the OpenStack documentation style, adding | ||
# oslosphinx to test-requirements.txt. | ||
#'oslosphinx', | ||
] | ||
|
||
# autodoc generation is a bit aggressive and a nuisance when doing heavy | ||
# text edit cycles. | ||
# execute "export SPHINX_DEBUG=1" in your terminal to disable | ||
|
||
# The suffix of source filenames. | ||
source_suffix = '.rst' | ||
|
||
# The master toctree document. | ||
master_doc = 'index' | ||
|
||
# General information about the project. | ||
project = u'os-capacity' | ||
copyright = u'2017, StackHPC Ltd.' | ||
|
||
# If true, '()' will be appended to :func: etc. cross-reference text. | ||
add_function_parentheses = True | ||
|
||
# If true, the current module name will be prepended to all description | ||
# unit titles (such as .. function::). | ||
add_module_names = True | ||
|
||
# The name of the Pygments (syntax highlighting) style to use. | ||
pygments_style = 'sphinx' | ||
|
||
# -- Options for HTML output -------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. Major themes that come with | ||
# Sphinx are currently 'default' and 'sphinxdoc'. | ||
# html_theme_path = ["."] | ||
# html_theme = '_theme' | ||
# html_static_path = ['static'] | ||
|
||
# Output file base name for HTML help builder. | ||
htmlhelp_basename = '%sdoc' % project | ||
|
||
# Grouping the document tree into LaTeX files. List of tuples | ||
# (source start file, target name, title, author, documentclass | ||
# [howto/manual]). | ||
latex_documents = [ | ||
('index', | ||
'%s.tex' % project, | ||
u'%s Documentation' % project, | ||
u'OpenStack Foundation', 'manual'), | ||
] | ||
|
||
# Example configuration for intersphinx: refer to the Python standard library. | ||
#intersphinx_mapping = {'http://docs.python.org/': None} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TODO development | ||
================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Welcome to os-capacity's documentation! | ||
======================================= | ||
|
||
.. include:: ../../README.rst | ||
|
||
Documentation | ||
------------- | ||
|
||
.. note:: | ||
|
||
nothing to see here yet :( | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
installation | ||
usage | ||
|
||
Developer Documentation | ||
----------------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TODO: Install | ||
============= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TODO: usage docs | ||
================ |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright (c) 2017 StackHPC Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
|
||
import logging | ||
import os | ||
|
||
from cliff.lister import Lister | ||
|
||
from os_capacity import utils | ||
|
||
|
||
class CapacityGet(Lister): | ||
"""Show a list of files in the current directory. | ||
The file name and size are printed by default. | ||
""" | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
def take_action(self, parsed_args): | ||
capacity = utils.get_capacity() | ||
return ( | ||
('Flavor', 'Count'), | ||
((entry["flavor"], entry["count"]) for entry in capacity) | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright (c) 2017 StackHPC Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import sys | ||
|
||
from cliff.app import App | ||
from cliff.commandmanager import CommandManager | ||
|
||
|
||
class CapacityApp(App): | ||
|
||
def __init__(self): | ||
super(CapacityApp, self).__init__( | ||
description='OS-Capacity (StackHPC) Command Line Interface (CLI)', | ||
version='0.1', | ||
command_manager=CommandManager('os_capacity.cli'), | ||
deferred_help=True, | ||
) | ||
|
||
def initialize_app(self, argv): | ||
self.LOG.debug('initialize_app') | ||
|
||
def prepare_to_run_command(self, cmd): | ||
self.LOG.debug('prepare_to_run_command %s', cmd.__class__.__name__) | ||
|
||
def clean_up(self, cmd, result, err): | ||
self.LOG.debug('clean_up %s', cmd.__class__.__name__) | ||
if err: | ||
self.LOG.debug('got an error: %s', err) | ||
|
||
|
||
def main(argv=sys.argv[1:]): | ||
myapp = CapacityApp() | ||
return myapp.run(argv) | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main(sys.argv[1:])) |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) 2017 StackHPC Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import unittest | ||
|
||
from os_capacity import utils | ||
|
||
|
||
class TestUtils(unittest.TestCase): | ||
|
||
def test_get_capacity(self): | ||
result = utils.get_capacity() | ||
self.assertEqual(1, len(result)) | ||
self.assertEqual(2, len(result[0])) | ||
self.assertEqual("foo", result[0]["flavor"]) | ||
self.assertEqual(1, result[0]["count"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2017 StackHPC Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
|
||
def get_capacity(): | ||
return [{"flavor": "foo", "count": 1}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cliff>=2.5.0 # Apache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[metadata] | ||
name = kayobe | ||
summary = Deployment of Scientific OpenStack using OpenStack Kolla | ||
description-file = | ||
README.rst | ||
author = Mark Goddard | ||
author-email = [email protected] | ||
home-page = https://stackhpc.com | ||
classifier = | ||
Environment :: OpenStack | ||
Intended Audience :: Information Technology | ||
Intended Audience :: System Administrators | ||
Operating System :: POSIX :: Linux | ||
Programming Language :: Python | ||
Programming Language :: Python :: 2 | ||
Programming Language :: Python :: 2.7 | ||
|
||
[files] | ||
packages = | ||
kayobe | ||
|
||
[build_sphinx] | ||
all-files = 1 | ||
source-dir = doc/source | ||
build-dir = doc/build | ||
|
||
[upload_sphinx] | ||
upload-dir = doc/build/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Copyright (c) 2017 StackHPC Ltd. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
#!/usr/bin/env python | ||
|
||
from setuptools import setup, find_packages | ||
|
||
|
||
PROJECT = 'os_capacity' | ||
VERSION = '0.1' | ||
|
||
try: | ||
long_description = open('README.md', 'rt').read() | ||
except IOError: | ||
long_description = '' | ||
|
||
setup( | ||
name=PROJECT, | ||
version=VERSION, | ||
|
||
description='OpenStack capacity tooling', | ||
long_description=long_description, | ||
|
||
author='StackHPC', | ||
author_email='[email protected]', | ||
|
||
url='https://github.com/stackhpc/os-capacity', | ||
download_url='https://github.com/stackhpc/os-capacity/tarball/master', | ||
|
||
provides=[], | ||
install_requires=open('requirements.txt', 'rt').read().splitlines(), | ||
|
||
namespace_packages=[], | ||
packages=find_packages(), | ||
include_package_data=True, | ||
|
||
entry_points={ | ||
'console_scripts': [ | ||
'os-capacity = os_capacity.cmd.os_capacity:main', | ||
], | ||
'os_capacity.cli': [ | ||
'capacity_get = os_capacity.cli.commands:CapacityGet', | ||
], | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# The order of packages is significant, because pip processes them in the order | ||
# of appearance. Changing the order has an impact on the overall integration | ||
# process, which may cause wedges in the gate later. | ||
|
||
hacking>=0.12.0,<0.13 # Apache-2.0 | ||
|
||
coverage>=4.0 # Apache-2.0 | ||
doc8 # Apache-2.0 | ||
sphinx>=1.5.1 # BSD | ||
oslotest>=1.10.0 # Apache-2.0 |
Oops, something went wrong.