Initial commit
Included basic cliff usage structure for the execition of three host commands. Includes Babel usage structure for i18n message extraction. Includes tox and pep8 usage structure for code quality / testing. Includes standard requirements.txt and test-requirements.txt files.
This commit is contained in:
commit
86b7524678
|
@ -0,0 +1 @@
|
|||
TODO(bmace) put stuff in here
|
|
@ -0,0 +1,35 @@
|
|||
import logging
|
||||
|
||||
from kollaclient.i18n import _
|
||||
|
||||
from cliff.command import Command
|
||||
|
||||
|
||||
class HostAdd(Command):
|
||||
"Host Add"
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.info(_("host add"))
|
||||
self.app.stdout.write(parsed_args)
|
||||
|
||||
|
||||
class HostRemove(Command):
|
||||
"Host Remove"
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.info(_("host remove"))
|
||||
self.app.stdout.write(parsed_args)
|
||||
|
||||
|
||||
class HostList(Command):
|
||||
"Host List"
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.info(_("host list"))
|
||||
self.app.stdout.write(parsed_args)
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright 2012-2013 OpenStack Foundation
|
||||
#
|
||||
# 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 oslo_i18n
|
||||
|
||||
_translators = oslo_i18n.TranslatorFactory(domain='openstack-kollaclient')
|
||||
|
||||
# The primary translation function using the well-known name "_"
|
||||
_ = _translators.primary
|
||||
|
||||
# Translators for log levels.
|
||||
#
|
||||
# The abbreviated names are meant to reflect the usual use of a short
|
||||
# name like '_'. The "L" is for "log" and the other letter comes from
|
||||
# the level.
|
||||
_LI = _translators.log_info
|
||||
_LW = _translators.log_warning
|
||||
_LE = _translators.log_error
|
||||
_LC = _translators.log_critical
|
|
@ -0,0 +1,48 @@
|
|||
# Copyright 2015 Oracle TODO(bmace) -- FIX THIS LINE
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
"""Command-line interface to Kolla"""
|
||||
|
||||
import sys
|
||||
|
||||
from cliff.app import App
|
||||
from cliff.commandmanager import CommandManager
|
||||
|
||||
|
||||
class KollaClient(App):
|
||||
|
||||
def __init__(self):
|
||||
super(KollaClient, self).__init__(
|
||||
description='Command-Line Client for StackForge Kolla',
|
||||
version='0.1',
|
||||
command_manager=CommandManager('kolla.client'),
|
||||
)
|
||||
self.dump_stack_trace = True
|
||||
|
||||
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('error: %s', err)
|
||||
|
||||
|
||||
def main(argv=sys.argv[1:]):
|
||||
shell = KollaClient()
|
||||
return shell.run(argv)
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv[1:]))
|
|
@ -0,0 +1,32 @@
|
|||
# Translations template for kollaclient.
|
||||
# Copyright (C) 2015 ORGANIZATION
|
||||
# This file is distributed under the same license as the kollaclient
|
||||
# project.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: kollaclient 0.1.dev0.g\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2015-07-15 13:29-0700\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 1.3\n"
|
||||
|
||||
#: kollaclient/host.py:14
|
||||
msgid "host add"
|
||||
msgstr ""
|
||||
|
||||
#: kollaclient/host.py:24
|
||||
msgid "host remove"
|
||||
msgstr ""
|
||||
|
||||
#: kollaclient/host.py:34
|
||||
msgid "host list"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
pbr>=0.11,<2.0
|
||||
six>=1.9.0
|
||||
|
||||
Babel>=1.3
|
||||
cliff>=1.10.0 # Apache-2.0
|
||||
oslo.i18n>=1.5.0 # Apache-2.0
|
|
@ -0,0 +1,50 @@
|
|||
[metadata]
|
||||
name = kollaclient
|
||||
version = 0.1
|
||||
|
||||
description-file =
|
||||
README.rst
|
||||
|
||||
author = Borne Mace
|
||||
author-email = borne.mace@oracle.com
|
||||
|
||||
url = https://ca-git.us.oracle.com/openstack-kollaclient
|
||||
|
||||
classifier =
|
||||
Development Status :: 3 - Alpha
|
||||
Environment :: Console
|
||||
Intended Audience :: Developers
|
||||
Intended Audience :: Information Technology
|
||||
Intended Audience :: System Administrators
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Programming Language :: Python :: 2
|
||||
Programming Language :: Python :: 2.7
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.4
|
||||
|
||||
[files]
|
||||
packages =
|
||||
kollaclient
|
||||
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
kollaclient = kollaclient.shell:main
|
||||
|
||||
kolla.client =
|
||||
host_add = kollaclient.host:HostAdd
|
||||
host_remove = kollaclient.host:HostRemove
|
||||
host_list = kollaclient.host:HostList
|
||||
|
||||
[extract_messages]
|
||||
keywords = _ gettext ngettext l_ lazy_gettext
|
||||
mapping_file = babel.cfg
|
||||
output_file = openstack-kollaclient/locale/openstack-kollaclient.pot
|
||||
|
||||
[update_catalog]
|
||||
domain = openstack-kollaclient
|
||||
output_dir = openstack-kollaclient/locale
|
||||
input_file = openstack-kollaclient/locale/openstack-kollaclient.pot
|
||||
|
||||
[compile_catalog]
|
||||
directory = openstack-kollaclient/locale
|
||||
domain = openstack-kollaclient
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright (c) 2015 Oracle TODO(bmace) fix this
|
||||
#
|
||||
# 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.
|
||||
|
||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||
import setuptools
|
||||
|
||||
# In python < 2.7.4, a lazy loading of package `pbr` will break
|
||||
# setuptools if some other modules registered functions in `atexit`.
|
||||
# solution from: http://bugs.python.org/issue15881#msg170215
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr'],
|
||||
pbr=True)
|
|
@ -0,0 +1,14 @@
|
|||
# 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 already pins down pep8, pyflakes and flake8
|
||||
hacking>=0.10.2,<0.11
|
||||
|
||||
coverage>=3.6
|
||||
discover
|
||||
fixtures>=0.3.14
|
||||
mock>=1.0
|
||||
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
|
||||
sphinxcontrib-pecanwsme>=0.8
|
||||
testrepository>=0.0.18
|
||||
testtools>=0.9.36,!=1.2.0
|
|
@ -0,0 +1,22 @@
|
|||
[tox]
|
||||
minversion = 1.6
|
||||
skipsdist = True
|
||||
envlist = py27,py34,pep8
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
install_command = pip install {opts} {packages}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
show-source = True
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
Loading…
Reference in New Issue