Compare commits

...

32 Commits

Author SHA1 Message Date
Anand Shanmugam
7f65e593f1 Disabling python2.7 zuul jobs
Change-Id: I048bc0518ed63eb8299a079fb66ca710f739857b
2020-05-28 12:49:51 +05:30
Anand Shanmugam
597e262d05 Adding zuul.yaml
Change-Id: I27173ced5274dc4b1cb2a36f2c11c04fa58723c3
2020-05-27 08:55:11 +00:00
qingszhao
b4ab1606c9 Removed older version of python added 3.5
In setup.cfg file the python 3.5 is added
In tox.ini the python 3.5 is added

Change-Id: I71b39e62edc783f716a2c57c4d15476bc5490c49
2020-05-14 13:01:39 +05:30
Zuul
542b98dfd4 Merge "Update and optimize documentation links" 2020-05-14 07:28:29 +00:00
Zuul
8469536fb9 Merge "add python 3.6 unit test job" 2020-05-14 07:27:36 +00:00
Zuul
ce82f1b36a Merge "Replacing the link in HACKING.rst" 2020-05-14 07:17:31 +00:00
Hangdong Zhang
e4c2d765e9 Update and optimize documentation links
1. Update URLs according to document migration
2. Update the dead and outdated links
3. Optimize (e.g. http -> https)

Change-Id: I27c37a91e07297c3821d7bb80ccbf9bcb881ff6b
2020-05-14 12:41:03 +05:30
Vieri
0a375baeff add python 3.6 unit test job
This is a mechanically generated patch to add a unit test job running
under Python 3.6 as part of the python3-first goal.

See the python3-first goal document for details:
https://governance.openstack.org/tc/goals/stein/python3-first.html

Change-Id: Ib9545d25756992b682e3af5e9eb72a1869feda3e
Story: #2002586
2020-05-14 12:38:42 +05:30
Zuul
76ed4e1025 Merge "Change openstack-dev to openstack-discuss" 2020-05-14 06:56:20 +00:00
zhouxinyong
717df99473 Replacing the link in HACKING.rst
Change-Id: Ib9c932df4b49938c2cf670c1282c0a70211a3ae1
2020-05-14 06:55:25 +00:00
Zuul
92af1b956c Merge "Add Python 3.6 classifier to setup.cfg" 2020-05-14 06:47:38 +00:00
98k
d28dc1f65c Change openstack-dev to openstack-discuss
Mailinglists have been updated. Openstack-discuss replaces openstack-dev.

Change-Id: If778d1e91663ff2493b873bb658f7743a6aef2b9
2020-05-14 06:34:33 +00:00
qingszhao
642ddf905c Add Python 3.6 classifier to setup.cfg
Change-Id: I3dacccfd61e970869c54448ad523c56d03e795d3
2020-05-14 05:46:36 +00:00
huang.zhiping
d598424ff9 Update min tox version to 2.0
The commands used by constraints need at least tox 2.0.  Update to
reflect reality, which should help with local running of constraints
targets.

Change-Id: I2cd383912478b6915b54b9dae7c1b2605e76154a
Closes-Bug:  #1801660
2020-05-14 05:46:15 +00:00
Sawan Choudhary
3749ebaee5 Handle cloudpulse result when result < 240
Change-Id: I82166f06b37d1821ce6d05f92d66c9f28db6091f
2020-04-07 00:02:21 -07:00
Sawan Choudhary
3cdea3ecfe Show latest cloudpulse results and not stale ones
Change-Id: I28b152f95e7bc300e079446a827c5542b8b04912
2020-02-11 22:36:12 -08:00
Sawan Choudhary
b95ebe3faf Add a --number arg to cloudpulse result, default 25
Change-Id: I7aca4b7312ff55c9c7eaa3b6b05322e090883842
2019-10-23 16:38:20 +05:30
OpenDev Sysadmins
3ec6495652 OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:50:47 +00:00
Sharmin Choksey
a8271f78a1 [Bug #1780882 ] Adds support for endpoint type
Provides support for endpoint_type via cli and openstack
OS_ENDPOINT_TYPE environment variable for cloudpulseclient

Change-Id: I2e6b5b6460da68b5308c33c9c0353efd9c7a9682
2018-07-09 18:28:56 -07:00
daohanli
b635bae846 Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: Ic939e5d999bf75533983d87cc068be66fbc1d905
2017-03-22 00:15:04 +08:00
Jenkins
50ac27de70 Merge "Fixes Keystone v3 401 authentication failures" 2017-03-08 15:47:39 +00:00
Sharmin Choksey
60014c9090 Fixes Keystone v3 401 authentication failures
Change-Id: I4c3dbd1f2ce09d322a9c7eef3355b1a3c93bb667
Partially-Closes-Bug: #1669238
2017-03-08 05:57:36 -08:00
Jenkins
65a87f0f09 Merge "Upgrade pip version" 2017-03-03 20:09:41 +00:00
Vinod Pandarinathan
1ed8565777 Upgrade pip version
Change-Id: I8e126cb677733bf9ce5295abec444edc51e8813c
2017-03-03 11:53:46 -08:00
Jenkins
66bd08bcbf Merge "Cloudpulse client requirements.txt to match stable/newton" 2017-02-20 18:44:30 +00:00
Jenkins
4a214fee4c Merge "Drop MANIFEST.in - it's not needed by pbr" 2017-02-20 18:44:24 +00:00
Jeremy Liu
eaf07754ab Enable coverage report in console output
Change-Id: I74fe81917ee0988b7359292729b0fcc475500229
2017-02-14 16:56:07 +08:00
Jeremy Liu
c862c35b46 Drop MANIFEST.in - it's not needed by pbr
This patch removes `MANIFEST.in` file as pbr generates a
sensible manifest from git files and some standard files
and it removes the need for an explicit `MANIFEST.in` file.

Change-Id: I625c6ed6cf554922e82cd3b285129e4814715104
2017-02-14 16:53:05 +08:00
Vinod Pandarinathan
6f32ff64c9 Cloudpulse client requirements.txt to match stable/newton
Change-Id: I1cb089a7f9533fb2f76aafffc6b5ac546017e444
2017-02-06 15:32:24 -08:00
Jenkins
fa34a025c6 Merge "Remove white space between print ()" 2017-02-06 18:28:03 +00:00
Anusree
cb688019c6 Remove white space between print ()
There was a white space between print and ()

Change-Id: Ieaf94259b7a53ce70c6e5f8c9e1e025ffccc64d9
2017-01-20 03:20:57 +05:30
DeepaJon
be15624da2 Removes unnecessary utf-8 encoding
This patches removes unnecessary utf-8 encoding in
cloudpulseclient/__init__.py
cloudpulseclient/common/base.py
cloudpulseclient/common/httpclient.py
cloudpulseclient/common/utils.py
cloudpulseclient/exceptions.py
cloudpulseclient/tests/base.py
cloudpulseclient/tests/test_cloudpulseclient.py
doc/source/conf.py

Change-Id: I68d798f959ec6d2be4182de4e53f618897ddd99d
2017-01-11 11:30:14 +05:30
25 changed files with 162 additions and 117 deletions

@ -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

@ -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

@ -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

@ -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]