Compare commits
32 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7f65e593f1 | ||
![]() |
597e262d05 | ||
![]() |
b4ab1606c9 | ||
![]() |
542b98dfd4 | ||
![]() |
8469536fb9 | ||
![]() |
ce82f1b36a | ||
![]() |
e4c2d765e9 | ||
![]() |
0a375baeff | ||
![]() |
76ed4e1025 | ||
![]() |
717df99473 | ||
![]() |
92af1b956c | ||
![]() |
d28dc1f65c | ||
![]() |
642ddf905c | ||
![]() |
d598424ff9 | ||
![]() |
3749ebaee5 | ||
![]() |
3cdea3ecfe | ||
![]() |
b95ebe3faf | ||
![]() |
3ec6495652 | ||
![]() |
a8271f78a1 | ||
![]() |
b635bae846 | ||
![]() |
50ac27de70 | ||
![]() |
60014c9090 | ||
![]() |
65a87f0f09 | ||
![]() |
1ed8565777 | ||
![]() |
66bd08bcbf | ||
![]() |
4a214fee4c | ||
![]() |
eaf07754ab | ||
![]() |
c862c35b46 | ||
![]() |
6f32ff64c9 | ||
![]() |
fa34a025c6 | ||
![]() |
cb688019c6 | ||
![]() |
be15624da2 |
.gitreview.zuul.yamlCONTRIBUTING.rstHACKING.rstMANIFEST.inREADME.rst
cloudpulseclient
doc/source
requirements.txtsetup.cfgtools
tox.ini@ -1,4 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
host=review.opendev.org
|
||||
port=29418
|
||||
project=openstack/python-cloudpulseclient.git
|
||||
project=x/python-cloudpulseclient.git
|
||||
|
7
.zuul.yaml
Normal file
7
.zuul.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-pep8
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-pep8
|
@ -1,13 +1,13 @@
|
||||
If you would like to contribute to the development of OpenStack,
|
||||
you must follow the steps in this page:
|
||||
|
||||
http://docs.openstack.org/infra/manual/developers.html
|
||||
https://docs.openstack.org/infra/manual/developers.html
|
||||
|
||||
Once those steps have been completed, changes to OpenStack
|
||||
should be submitted for review via the Gerrit tool, following
|
||||
the workflow documented at:
|
||||
|
||||
http://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||
https://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||
|
||||
Pull requests submitted through GitHub will be ignored.
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
python-cloudpulseclient Style Commandments
|
||||
===============================================
|
||||
|
||||
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/
|
||||
Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/
|
||||
|
@ -1,6 +0,0 @@
|
||||
include AUTHORS
|
||||
include ChangeLog
|
||||
exclude .gitignore
|
||||
exclude .gitreview
|
||||
|
||||
global-exclude *.pyc
|
@ -5,9 +5,9 @@ python-cloudpulseclient
|
||||
A Python language binding for OpenStack CloudPulse.
|
||||
|
||||
* Free software: Apache license
|
||||
* Documentation: http://wiki.openstack.org/wiki/Cloudpulse
|
||||
* Source: http://git.openstack.org/cgit/stackforge/python-cloudpulseclient
|
||||
* Bugs: http://bugs.launchpad.net/python-cloudpulseclient
|
||||
* Documentation: https://wiki.openstack.org/wiki/Cloudpulse
|
||||
* Source: http://git.openstack.org/cgit/openstack/python-cloudpulseclient
|
||||
* Bugs: https://bugs.launchpad.net/python-cloudpulseclient
|
||||
|
||||
Features
|
||||
--------
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- 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
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2012 OpenStack LLC.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2012 OpenStack LLC.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2012 OpenStack LLC.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- 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
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
"""oslo_i18n integration module for cloudpulseclient.
|
||||
|
||||
See http://docs.openstack.org/developer/oslo.i18n/usage.html .
|
||||
See https://docs.openstack.org/oslo.i18n/latest/user/usage.html.
|
||||
|
||||
"""
|
||||
|
||||
@ -23,13 +23,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='cloudpulseclient')
|
||||
|
||||
# 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
|
||||
|
@ -12,34 +12,18 @@
|
||||
|
||||
"""oslo.i18n integration module.
|
||||
|
||||
See http://docs.openstack.org/developer/oslo.i18n/usage.html
|
||||
See https://docs.openstack.org/oslo.i18n/latest/user/usage.html
|
||||
|
||||
"""
|
||||
|
||||
try:
|
||||
import oslo_i18n
|
||||
import oslo_i18n
|
||||
|
||||
# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
|
||||
# application name when this module is synced into the separate
|
||||
# repository. It is OK to have more than one translation function
|
||||
# using the same domain, since there will still only be one message
|
||||
# catalog.
|
||||
_translators = oslo_i18n.TranslatorFactory(domain='cloudpulseclient')
|
||||
# NOTE(dhellmann): This reference to o-s-l-o will be replaced by the
|
||||
# application name when this module is synced into the separate
|
||||
# repository. It is OK to have more than one translation function
|
||||
# using the same domain, since there will still only be one message
|
||||
# catalog.
|
||||
_translators = oslo_i18n.TranslatorFactory(domain='cloudpulseclient')
|
||||
|
||||
# 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
|
||||
except ImportError:
|
||||
# NOTE(dims): Support for cases where a project wants to use
|
||||
# code from oslo-incubator, but is not ready to be internationalized
|
||||
# (like tempest)
|
||||
_ = _LI = _LW = _LE = _LC = lambda x: x
|
||||
# The primary translation function using the well-known name "_"
|
||||
_ = _translators.primary
|
||||
|
@ -127,6 +127,8 @@ class BaseAuthPlugin(object):
|
||||
"tenant_name",
|
||||
"token",
|
||||
"auth_url",
|
||||
"project_domain_name",
|
||||
"user_domain_name",
|
||||
]
|
||||
|
||||
def __init__(self, auth_system=None, **kwargs):
|
||||
|
@ -41,6 +41,27 @@ class MissingArgs(Exception):
|
||||
super(MissingArgs, self).__init__(msg)
|
||||
|
||||
|
||||
class InvalidNumber(Exception):
|
||||
"""Supplied argument for --number is invalid"""
|
||||
def __init__(self):
|
||||
msg = _("Invalid input, expected a number in range 1<=number<=240")
|
||||
super(InvalidNumber, self).__init__(msg)
|
||||
|
||||
|
||||
def check_int_limit(value):
|
||||
"""Check that supplied arg is of integer type and in range 1<=value<=240"""
|
||||
try:
|
||||
int_value = int(value)
|
||||
except (ValueError, TypeError):
|
||||
raise InvalidNumber()
|
||||
|
||||
# max_db_entries in cloudpulse is 240, hence this limit
|
||||
if not 1 <= int_value <= 240:
|
||||
raise InvalidNumber()
|
||||
|
||||
return int_value
|
||||
|
||||
|
||||
def validate_args(fn, *args, **kwargs):
|
||||
"""Check that the supplied args are sufficient for calling a function.
|
||||
|
||||
@ -139,7 +160,7 @@ def isunauthenticated(func):
|
||||
|
||||
|
||||
def print_list(objs, fields, formatters=None, sortby_index=0,
|
||||
mixed_case_fields=None, field_labels=None):
|
||||
mixed_case_fields=None, field_labels=None, limit_number=25):
|
||||
"""Print a list or objects as a table, one row per object.
|
||||
|
||||
:param objs: iterable of :class:`Resource`
|
||||
@ -163,10 +184,16 @@ def print_list(objs, fields, formatters=None, sortby_index=0,
|
||||
kwargs = {}
|
||||
else:
|
||||
kwargs = {'sortby': field_labels[sortby_index]}
|
||||
|
||||
# Limit the number to 25 (default) or provided number from user
|
||||
# Show last entries after sorting
|
||||
kwargs['start'] = 0
|
||||
kwargs['end'] = limit_number
|
||||
|
||||
pt = prettytable.PrettyTable(field_labels)
|
||||
pt.align = 'l'
|
||||
|
||||
for o in objs:
|
||||
for o in objs[::-1]:
|
||||
row = []
|
||||
for field in fields:
|
||||
if field in formatters:
|
||||
@ -267,5 +294,5 @@ def pretty_choice_list(l):
|
||||
|
||||
def exit(msg=''):
|
||||
if msg:
|
||||
print (msg, file=sys.stderr)
|
||||
print(msg, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
@ -33,6 +33,13 @@ from oslo_utils import encodeutils
|
||||
from oslo_utils import strutils
|
||||
import six
|
||||
|
||||
from cloudpulseclient.openstack.common.apiclient import auth
|
||||
from cloudpulseclient.openstack.common.apiclient import exceptions as exc
|
||||
from cloudpulseclient.openstack.common import cliutils
|
||||
from cloudpulseclient.v1 import client
|
||||
from cloudpulseclient.v1 import shell as shell_v1
|
||||
from cloudpulseclient import version
|
||||
|
||||
HAS_KEYRING = False
|
||||
all_errors = ValueError
|
||||
try:
|
||||
@ -49,13 +56,6 @@ try:
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
from cloudpulseclient.openstack.common.apiclient import auth
|
||||
from cloudpulseclient.openstack.common.apiclient import exceptions as exc
|
||||
from cloudpulseclient.openstack.common import cliutils
|
||||
from cloudpulseclient.v1 import client
|
||||
from cloudpulseclient.v1 import shell as shell_v1
|
||||
from cloudpulseclient import version
|
||||
|
||||
DEFAULT_API_VERSION = '1'
|
||||
DEFAULT_ENDPOINT_TYPE = 'publicURL'
|
||||
DEFAULT_SERVICE_TYPE = 'health'
|
||||
@ -294,9 +294,11 @@ class OpenStackCloudPulseShell(object):
|
||||
metavar='<endpoint-type>',
|
||||
default=cliutils.env(
|
||||
'CLOUDPULSE_ENDPOINT_TYPE',
|
||||
default=DEFAULT_ENDPOINT_TYPE),
|
||||
help='Defaults to env[CLOUDPULSE_ENDPOINT_TYPE] or'
|
||||
+ DEFAULT_ENDPOINT_TYPE + '.')
|
||||
default=cliutils.env(
|
||||
'OS_ENDPOINT_TYPE',
|
||||
default=DEFAULT_ENDPOINT_TYPE)),
|
||||
help='Defaults to env[CLOUDPULSE_ENDPOINT_TYPE] '
|
||||
'or' + DEFAULT_ENDPOINT_TYPE + '.')
|
||||
# NOTE(dtroyer): We can't add --endpoint_type here due to argparse
|
||||
# thinking usage-list --end is ambiguous; but it
|
||||
# works fine with only --endpoint-type present
|
||||
@ -521,16 +523,20 @@ class OpenStackCloudPulseShell(object):
|
||||
'--os-password, env[OS_PASSWORD], or '
|
||||
'prompted response')
|
||||
|
||||
self.cs = client.Client(username=os_username,
|
||||
api_key=os_password,
|
||||
project_id=os_tenant_id,
|
||||
project_name=os_tenant_name,
|
||||
auth_url=os_auth_url,
|
||||
service_type=service_type,
|
||||
region_name=args.os_region_name,
|
||||
cacert=cacert,
|
||||
insecure=insecure,
|
||||
cloudpulse_url=bypass_url)
|
||||
self.cs = client.Client(
|
||||
username=os_username,
|
||||
api_key=os_password,
|
||||
project_id=os_tenant_id,
|
||||
project_name=os_tenant_name,
|
||||
auth_url=os_auth_url,
|
||||
service_type=service_type,
|
||||
region_name=args.os_region_name,
|
||||
project_domain_name=args.os_project_domain_name,
|
||||
user_domain_name=args.os_user_domain_name,
|
||||
cacert=cacert,
|
||||
insecure=insecure,
|
||||
cloudpulse_url=bypass_url,
|
||||
endpoint_type=endpoint_type)
|
||||
|
||||
args.func(self.cs, args)
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2010-2011 OpenStack Foundation
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
|
@ -1,5 +1,3 @@
|
||||
# -*- 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
|
||||
|
@ -25,18 +25,22 @@ class Client(object):
|
||||
def __init__(self, username=None, api_key=None, project_id=None,
|
||||
project_name=None, auth_url=None, cloudpulse_url=None,
|
||||
endpoint_type='publicURL', service_type='container',
|
||||
project_domain_name=None, user_domain_name=None,
|
||||
region_name=None, input_auth_token=None, insecure=False,
|
||||
cacert=None):
|
||||
|
||||
keystone = None
|
||||
if not input_auth_token:
|
||||
keystone = self.get_keystone_client(username=username,
|
||||
api_key=api_key,
|
||||
auth_url=auth_url,
|
||||
project_id=project_id,
|
||||
project_name=project_name,
|
||||
insecure=insecure,
|
||||
cacert=cacert)
|
||||
keystone = self.get_keystone_client(
|
||||
username=username,
|
||||
api_key=api_key,
|
||||
auth_url=auth_url,
|
||||
project_id=project_id,
|
||||
project_name=project_name,
|
||||
project_domain_name=project_domain_name,
|
||||
user_domain_name=user_domain_name,
|
||||
insecure=insecure,
|
||||
cacert=cacert)
|
||||
|
||||
input_auth_token = keystone.auth_token
|
||||
if not input_auth_token:
|
||||
@ -80,6 +84,7 @@ class Client(object):
|
||||
@staticmethod
|
||||
def get_keystone_client(username=None, api_key=None, auth_url=None,
|
||||
insecure=False, cacert=None, token=None,
|
||||
project_domain_name=None, user_domain_name=None,
|
||||
project_id=None, project_name=None):
|
||||
if not auth_url:
|
||||
raise RuntimeError("No auth url specified")
|
||||
@ -94,6 +99,8 @@ class Client(object):
|
||||
cacert=cacert,
|
||||
tenant_id=project_id,
|
||||
tenant_name=project_name,
|
||||
project_domain_name=project_domain_name,
|
||||
user_domain_name=user_domain_name,
|
||||
auth_url=auth_url,
|
||||
endpoint=auth_url)
|
||||
client.authenticate()
|
||||
|
@ -29,17 +29,22 @@ def _print_list_field(field):
|
||||
@utils.arg('--period',
|
||||
metavar='<period>',
|
||||
help='List tests results that have been run in the last x minutes.')
|
||||
@utils.arg('--number',
|
||||
metavar='<number>',
|
||||
default=25,
|
||||
type=utils.check_int_limit,
|
||||
help='List x number of tests (Max 240).')
|
||||
def do_result(cs, args):
|
||||
"""List all the test results"""
|
||||
search_opts = {
|
||||
'failed': args.failed,
|
||||
'period': args.period,
|
||||
'period': args.period
|
||||
}
|
||||
healtchecks = cs.healthcheck.list(search_opts=search_opts)
|
||||
columns = ('uuid', 'id', 'name', 'testtype', 'state')
|
||||
utils.print_list(healtchecks, columns,
|
||||
{'versions': _print_list_field('versions')},
|
||||
sortby_index=1)
|
||||
sortby_index=1, limit_number=args.number)
|
||||
|
||||
|
||||
@utils.arg('--name',
|
||||
|
@ -1,4 +1,3 @@
|
||||
# -*- 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
|
||||
|
@ -2,13 +2,13 @@
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
pbr>=1.6
|
||||
Babel>=1.3
|
||||
oslo.config>=2.3.0 # Apache-2.0
|
||||
oslo.i18n>=1.5.0 # Apache-2.0`
|
||||
oslo.utils>=2.0.0,!=2.6.0 # Apache-2.0
|
||||
iso8601>=0.1.9
|
||||
requests>=2.5.2,!=2.8.0,!=2.9.0
|
||||
python-keystoneclient>=1.6.0,!=1.8.0
|
||||
PyYAML>=3.1.0
|
||||
stevedore>=1.5.0 # Apache-2.0
|
||||
six>=1.9.0
|
||||
Babel>=2.3.4 # BSD
|
||||
oslo.config>=3.14.0 # Apache-2.0
|
||||
oslo.i18n>=2.1.0 # Apache-2.0
|
||||
oslo.utils>=3.16.0 # Apache-2.0
|
||||
iso8601>=0.1.11 # MIT
|
||||
requests>=2.10.0 # Apache-2.0
|
||||
python-keystoneclient>=2.0.0,!=2.1.0 # Apache-2.0
|
||||
PyYAML>=3.1.0 # MIT
|
||||
stevedore>=1.16.0 # Apache-2.0
|
||||
six>=1.9.0 # MIT
|
||||
|
@ -4,7 +4,7 @@ summary = A Python language binding for OpenStack CloudPulse.
|
||||
description-file =
|
||||
README.rst
|
||||
author = OpenStack
|
||||
author-email = openstack-dev@lists.openstack.org
|
||||
author-email = openstack-discuss@lists.openstack.org
|
||||
home-page = http://www.openstack.org/
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
@ -18,6 +18,8 @@ classifier =
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.3
|
||||
Programming Language :: Python :: 3.4
|
||||
Programming Language :: Python :: 3.5
|
||||
Programming Language :: Python :: 3.6
|
||||
|
||||
[files]
|
||||
packages =
|
||||
|
20
tools/flake8wrap.sh
Executable file
20
tools/flake8wrap.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# A simple wrapper around flake8 which makes it possible
|
||||
# to ask it to only verify files changed in the current
|
||||
# git HEAD patch.
|
||||
#
|
||||
# Intended to be invoked via tox:
|
||||
#
|
||||
# tox -epep8 -- -HEAD
|
||||
#
|
||||
|
||||
if test "x$1" = "x-HEAD" ; then
|
||||
shift
|
||||
files=$(git diff --name-only HEAD~1 | tr '\n' ' ')
|
||||
echo "Running flake8 on ${files}"
|
||||
diff -u --from-file /dev/null ${files} | flake8 --diff "$@"
|
||||
else
|
||||
echo "Running flake8 on all files"
|
||||
exec flake8 "$@"
|
||||
fi
|
32
tox.ini
32
tox.ini
@ -1,30 +1,46 @@
|
||||
[tox]
|
||||
minversion = 1.6
|
||||
envlist = py34,py27,pep8
|
||||
minversion = 2.0
|
||||
envlist = py36,pep8
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
basepython = python3
|
||||
usedevelop = True
|
||||
install_command = pip install {opts} {packages}
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands = python setup.py test --slowest --testr-args='{posargs}'
|
||||
PYTHONWARNINGS=default::DeprecationWarning
|
||||
OS_STDOUT_CAPTURE=1
|
||||
OS_STDERR_CAPTURE=1
|
||||
deps =
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
passenv = TEMPEST_* OS_TEST_*
|
||||
commands =
|
||||
find . -type f -name "*.py[c|o]" -delete
|
||||
stestr run {posargs}
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
commands =
|
||||
bash tools/flake8wrap.sh {posargs}
|
||||
|
||||
[testenv:venv]
|
||||
basepython = python3
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
commands = python setup.py test --coverage --testr-args='{posargs}'
|
||||
basepython = python3
|
||||
commands =
|
||||
python setup.py test --coverage --testr-args='{posargs}'
|
||||
coverage report
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
[testenv:debug]
|
||||
basepython = python3
|
||||
commands = oslo_debug_helper {posargs}
|
||||
|
||||
[flake8]
|
||||
|
Loading…
x
Reference in New Issue
Block a user