Merge "code compatibility with py3"

This commit is contained in:
Jenkins 2016-05-31 23:33:00 +00:00 committed by Gerrit Code Review
commit e3422a314b
4 changed files with 10 additions and 7 deletions

View File

@ -22,6 +22,7 @@ import textwrap
import uuid
import prettytable
import six
import yaml
from monascaclient import exc
@ -289,6 +290,6 @@ def set_env_variables(kwargs):
'domain_name': 'OS_DOMAIN_NAME',
'region_name': 'OS_REGION_NAME'
}
for k, v in environment_variables.iteritems():
for k, v in six.iteritems(environment_variables):
if k not in kwargs:
kwargs[k] = env(v)

View File

@ -41,13 +41,13 @@ def fake_headers():
'User-Agent': 'python-monascaclient'}
class FakeServiceCatalog():
class FakeServiceCatalog(object):
def url_for(self, endpoint_type, service_type):
return 'http://192.168.1.5:8004/v1/f14b41234'
class FakeKeystone():
class FakeKeystone(object):
service_catalog = FakeServiceCatalog()
def __init__(self, auth_token, project_id):
@ -55,11 +55,11 @@ class FakeKeystone():
self.project_id = project_id
class FakeRaw():
class FakeRaw(object):
version = 110
class FakeHTTPResponse():
class FakeHTTPResponse(object):
version = 1.1

View File

@ -23,6 +23,7 @@ from monascaclient.common import utils
import monascaclient.exc as exc
from monascaclient.openstack.common import jsonutils
from six.moves import xrange
# Alarm valid types
severity_types = ['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']

View File

@ -18,12 +18,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import ConfigParser
import os
import sys
import install_venv_common as install_venv # flake8: noqa
from six.moves import configparser as ConfigParser
def print_help(project, venv, root):
help = """
@ -42,7 +43,7 @@ def print_help(project, venv, root):
$ %(root)s/tools/with_venv.sh <your command>
"""
print help % dict(project=project, venv=venv, root=root)
print(help % dict(project=project, venv=venv, root=root))
def main(argv):