Merge "Use built-in print() instead of print statement"
This commit is contained in:
commit
f7d4f46589
@ -21,6 +21,7 @@ Executes networking commands in dom0. The XenAPI plugin is
|
|||||||
responsible determining whether a command is safe to execute.
|
responsible determining whether a command is safe to execute.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import json
|
import json
|
||||||
@ -42,7 +43,7 @@ def parse_args():
|
|||||||
exec_name = sys.argv.pop(0)
|
exec_name = sys.argv.pop(0)
|
||||||
# argv[0] required; path to conf file
|
# argv[0] required; path to conf file
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print "%s: No command specified" % exec_name
|
print("%s: No command specified" % exec_name)
|
||||||
sys.exit(RC_NOCOMMAND)
|
sys.exit(RC_NOCOMMAND)
|
||||||
|
|
||||||
config_file = sys.argv.pop(0)
|
config_file = sys.argv.pop(0)
|
||||||
@ -56,7 +57,7 @@ def _xenapi_section_name(config):
|
|||||||
if len(sections) == 1:
|
if len(sections) == 1:
|
||||||
return sections[0]
|
return sections[0]
|
||||||
|
|
||||||
print "Multiple [xenapi] sections or no [xenapi] section found!"
|
print("Multiple [xenapi] sections or no [xenapi] section found!")
|
||||||
sys.exit(RC_BADCONFIG)
|
sys.exit(RC_BADCONFIG)
|
||||||
|
|
||||||
|
|
||||||
@ -71,13 +72,13 @@ def load_configuration(exec_name, config_file):
|
|||||||
username = config.get(section, "xenapi_connection_username")
|
username = config.get(section, "xenapi_connection_username")
|
||||||
password = config.get(section, "xenapi_connection_password")
|
password = config.get(section, "xenapi_connection_password")
|
||||||
except ConfigParser.Error:
|
except ConfigParser.Error:
|
||||||
print "%s: Incorrect configuration file: %s" % (exec_name, config_file)
|
print("%s: Incorrect configuration file: %s" % (exec_name, config_file))
|
||||||
sys.exit(RC_BADCONFIG)
|
sys.exit(RC_BADCONFIG)
|
||||||
if not url or not password:
|
if not url or not password:
|
||||||
msg = ("%s: Must specify xenapi_connection_url, "
|
msg = ("%s: Must specify xenapi_connection_url, "
|
||||||
"xenapi_connection_username (optionally), and "
|
"xenapi_connection_username (optionally), and "
|
||||||
"xenapi_connection_password in %s") % (exec_name, config_file)
|
"xenapi_connection_password in %s") % (exec_name, config_file)
|
||||||
print msg
|
print(msg)
|
||||||
sys.exit(RC_BADCONFIG)
|
sys.exit(RC_BADCONFIG)
|
||||||
return dict(
|
return dict(
|
||||||
filters_path=filters_path,
|
filters_path=filters_path,
|
||||||
@ -102,7 +103,7 @@ def filter_command(exec_name, filters_path, user_args, exec_dirs):
|
|||||||
filter_match = wrapper.match_filter(
|
filter_match = wrapper.match_filter(
|
||||||
filters, user_args, exec_dirs=exec_dirs)
|
filters, user_args, exec_dirs=exec_dirs)
|
||||||
if not filter_match:
|
if not filter_match:
|
||||||
print "Unauthorized command: %s" % ' '.join(user_args)
|
print("Unauthorized command: %s" % ' '.join(user_args))
|
||||||
sys.exit(RC_UNAUTHORIZED)
|
sys.exit(RC_UNAUTHORIZED)
|
||||||
|
|
||||||
|
|
||||||
@ -128,4 +129,4 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print main()
|
print(main())
|
||||||
|
@ -21,6 +21,7 @@ Executes networking commands in dom0. The XenAPI plugin is
|
|||||||
responsible determining whether a command is safe to execute.
|
responsible determining whether a command is safe to execute.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import json
|
import json
|
||||||
@ -42,7 +43,7 @@ def parse_args():
|
|||||||
exec_name = sys.argv.pop(0)
|
exec_name = sys.argv.pop(0)
|
||||||
# argv[0] required; path to conf file
|
# argv[0] required; path to conf file
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print "%s: No command specified" % exec_name
|
print("%s: No command specified" % exec_name)
|
||||||
sys.exit(RC_NOCOMMAND)
|
sys.exit(RC_NOCOMMAND)
|
||||||
|
|
||||||
config_file = sys.argv.pop(0)
|
config_file = sys.argv.pop(0)
|
||||||
@ -56,7 +57,7 @@ def _xenapi_section_name(config):
|
|||||||
if len(sections) == 1:
|
if len(sections) == 1:
|
||||||
return sections[0]
|
return sections[0]
|
||||||
|
|
||||||
print "Multiple [xenapi] sections or no [xenapi] section found!"
|
print("Multiple [xenapi] sections or no [xenapi] section found!")
|
||||||
sys.exit(RC_BADCONFIG)
|
sys.exit(RC_BADCONFIG)
|
||||||
|
|
||||||
|
|
||||||
@ -71,13 +72,13 @@ def load_configuration(exec_name, config_file):
|
|||||||
username = config.get(section, "xenapi_connection_username")
|
username = config.get(section, "xenapi_connection_username")
|
||||||
password = config.get(section, "xenapi_connection_password")
|
password = config.get(section, "xenapi_connection_password")
|
||||||
except ConfigParser.Error:
|
except ConfigParser.Error:
|
||||||
print "%s: Incorrect configuration file: %s" % (exec_name, config_file)
|
print("%s: Incorrect configuration file: %s" % (exec_name, config_file))
|
||||||
sys.exit(RC_BADCONFIG)
|
sys.exit(RC_BADCONFIG)
|
||||||
if not url or not password:
|
if not url or not password:
|
||||||
msg = ("%s: Must specify xenapi_connection_url, "
|
msg = ("%s: Must specify xenapi_connection_url, "
|
||||||
"xenapi_connection_username (optionally), and "
|
"xenapi_connection_username (optionally), and "
|
||||||
"xenapi_connection_password in %s") % (exec_name, config_file)
|
"xenapi_connection_password in %s") % (exec_name, config_file)
|
||||||
print msg
|
print(msg)
|
||||||
sys.exit(RC_BADCONFIG)
|
sys.exit(RC_BADCONFIG)
|
||||||
return dict(
|
return dict(
|
||||||
filters_path=filters_path,
|
filters_path=filters_path,
|
||||||
@ -102,7 +103,7 @@ def filter_command(exec_name, filters_path, user_args, exec_dirs):
|
|||||||
filter_match = wrapper.match_filter(
|
filter_match = wrapper.match_filter(
|
||||||
filters, user_args, exec_dirs=exec_dirs)
|
filters, user_args, exec_dirs=exec_dirs)
|
||||||
if not filter_match:
|
if not filter_match:
|
||||||
print "Unauthorized command: %s" % ' '.join(user_args)
|
print("Unauthorized command: %s" % ' '.join(user_args))
|
||||||
sys.exit(RC_UNAUTHORIZED)
|
sys.exit(RC_UNAUTHORIZED)
|
||||||
|
|
||||||
|
|
||||||
@ -128,4 +129,4 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print main()
|
print(main())
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
Used for NeutronRestProxy tests
|
Used for NeutronRestProxy tests
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
@ -128,15 +129,15 @@ class TestNetworkCtrl(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print '\n'
|
print('\n')
|
||||||
if self.debug_env:
|
if self.debug_env:
|
||||||
print '%s:' % 'environ:'
|
print('environ:')
|
||||||
for (key, value) in sorted(environ.iteritems()):
|
for (key, value) in sorted(environ.iteritems()):
|
||||||
print ' %16s : %s' % (key, value)
|
print(' %16s : %s' % (key, value))
|
||||||
|
|
||||||
print '%s %s' % (method, uri)
|
print('%s %s' % (method, uri))
|
||||||
if request_data:
|
if request_data:
|
||||||
print '%s' % (
|
print('%s' %
|
||||||
json.dumps(request_data, sort_keys=True, indent=4))
|
json.dumps(request_data, sort_keys=True, indent=4))
|
||||||
|
|
||||||
status, body = self.request_handler(method, uri, None)
|
status, body = self.request_handler(method, uri, None)
|
||||||
@ -151,13 +152,13 @@ class TestNetworkCtrl(object):
|
|||||||
start_response(status, headers)
|
start_response(status, headers)
|
||||||
if self.debug:
|
if self.debug:
|
||||||
if self.debug_env:
|
if self.debug_env:
|
||||||
print '%s: %s' % ('Response',
|
print('%s: %s' % ('Response',
|
||||||
json.dumps(body_data, sort_keys=True, indent=4))
|
json.dumps(body_data, sort_keys=True, indent=4)))
|
||||||
return body
|
return body
|
||||||
return make_server(self.host, self.port, app)
|
return make_server(self.host, self.port, app)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
print "Serving on port %d ..." % self.port
|
print("Serving on port %d ..." % self.port)
|
||||||
try:
|
try:
|
||||||
self.server().serve_forever()
|
self.server().serve_forever()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
# @author: Mandeep Dhami, Big Switch Networks, Inc.
|
# @author: Mandeep Dhami, Big Switch Networks, Inc.
|
||||||
|
|
||||||
"""Determine version of NeutronRestProxy plugin"""
|
"""Determine version of NeutronRestProxy plugin"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
# if vcsversion exists, use it. Else, use LOCALBRANCH:LOCALREVISION
|
# if vcsversion exists, use it. Else, use LOCALBRANCH:LOCALREVISION
|
||||||
try:
|
try:
|
||||||
@ -61,4 +62,4 @@ def version_string_with_vcs():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print version_string_with_vcs()
|
print(version_string_with_vcs())
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
"""Brocade NOS Driver CLI."""
|
"""Brocade NOS Driver CLI."""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
@ -50,7 +51,7 @@ class NOSCli(object):
|
|||||||
elif args.cmd == 'dissociate' and numargs == 2:
|
elif args.cmd == 'dissociate' and numargs == 2:
|
||||||
self._dissociate(args.otherargs[0], args.otherargs[1])
|
self._dissociate(args.otherargs[0], args.otherargs[1])
|
||||||
else:
|
else:
|
||||||
print usage_desc
|
print(usage_desc)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
def _create(self, net_id):
|
def _create(self, net_id):
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
|
|
||||||
"""Brocade NOS Driver Test."""
|
"""Brocade NOS Driver Test."""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from neutron.plugins.brocade.nos import nosdriver as nos
|
from neutron.plugins.brocade.nos import nosdriver as nos
|
||||||
@ -38,8 +40,8 @@ def nostest(host, username, password):
|
|||||||
|
|
||||||
# AMPP enumeration
|
# AMPP enumeration
|
||||||
with driver.connect(host, username, password) as mgr:
|
with driver.connect(host, username, password) as mgr:
|
||||||
print driver.get_port_profiles(mgr)
|
print(driver.get_port_profiles(mgr))
|
||||||
print driver.get_port_profile(mgr, 'default')
|
print(driver.get_port_profile(mgr, 'default'))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#
|
#
|
||||||
# @author: Aaron Rosen, VMware
|
# @author: Aaron Rosen, VMware
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
@ -31,7 +33,7 @@ config.setup_logging(cfg.CONF)
|
|||||||
|
|
||||||
|
|
||||||
def help(name):
|
def help(name):
|
||||||
print "Usage: %s path/to/nvp.ini" % name
|
print("Usage: %s path/to/nvp.ini" % name)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
@ -55,33 +57,33 @@ def main(argv):
|
|||||||
args = ['--config-file']
|
args = ['--config-file']
|
||||||
args.append(argv[1])
|
args.append(argv[1])
|
||||||
config.parse(args)
|
config.parse(args)
|
||||||
print "------------------------ Database Options ------------------------"
|
print("----------------------- Database Options -----------------------")
|
||||||
print "\tconnection: %s" % cfg.CONF.database.connection
|
print("\tconnection: %s" % cfg.CONF.database.connection)
|
||||||
print "\tretry_interval: %d" % cfg.CONF.database.retry_interval
|
print("\tretry_interval: %d" % cfg.CONF.database.retry_interval)
|
||||||
print "\tmax_retries: %d" % cfg.CONF.database.max_retries
|
print("\tmax_retries: %d" % cfg.CONF.database.max_retries)
|
||||||
print "------------------------ NVP Options ------------------------"
|
print("----------------------- NVP Options -----------------------")
|
||||||
print "\tNVP Generation Timeout %d" % cfg.CONF.NVP.nvp_gen_timeout
|
print("\tNVP Generation Timeout %d" % cfg.CONF.NVP.nvp_gen_timeout)
|
||||||
print ("\tNumber of concurrent connections to each controller %d" %
|
print("\tNumber of concurrent connections to each controller %d" %
|
||||||
cfg.CONF.NVP.concurrent_connections)
|
cfg.CONF.NVP.concurrent_connections)
|
||||||
print "\tmax_lp_per_bridged_ls: %s" % cfg.CONF.NVP.max_lp_per_bridged_ls
|
print("\tmax_lp_per_bridged_ls: %s" % cfg.CONF.NVP.max_lp_per_bridged_ls)
|
||||||
print "\tmax_lp_per_overlay_ls: %s" % cfg.CONF.NVP.max_lp_per_overlay_ls
|
print("\tmax_lp_per_overlay_ls: %s" % cfg.CONF.NVP.max_lp_per_overlay_ls)
|
||||||
print "------------------------ Cluster Options ------------------------"
|
print("----------------------- Cluster Options -----------------------")
|
||||||
print "\trequested_timeout: %s" % cfg.CONF.req_timeout
|
print("\trequested_timeout: %s" % cfg.CONF.req_timeout)
|
||||||
print "\tretries: %s" % cfg.CONF.retries
|
print("\tretries: %s" % cfg.CONF.retries)
|
||||||
print "\tredirects: %s" % cfg.CONF.redirects
|
print("\tredirects: %s" % cfg.CONF.redirects)
|
||||||
print "\thttp_timeout: %s" % cfg.CONF.http_timeout
|
print("\thttp_timeout: %s" % cfg.CONF.http_timeout)
|
||||||
cluster = NeutronPlugin.create_nvp_cluster(
|
cluster = NeutronPlugin.create_nvp_cluster(
|
||||||
cfg.CONF,
|
cfg.CONF,
|
||||||
cfg.CONF.NVP.concurrent_connections,
|
cfg.CONF.NVP.concurrent_connections,
|
||||||
cfg.CONF.NVP.nvp_gen_timeout)
|
cfg.CONF.NVP.nvp_gen_timeout)
|
||||||
num_controllers = len(cluster.nvp_controllers)
|
num_controllers = len(cluster.nvp_controllers)
|
||||||
print "Number of controllers found: %s" % num_controllers
|
print("Number of controllers found: %s" % num_controllers)
|
||||||
if num_controllers == 0:
|
if num_controllers == 0:
|
||||||
print "You must specify at least one controller!"
|
print("You must specify at least one controller!")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
for controller in cluster.nvp_controllers:
|
for controller in cluster.nvp_controllers:
|
||||||
print "\tController endpoint: %s" % controller
|
print("\tController endpoint: %s" % controller)
|
||||||
nvplib.check_cluster_connectivity(cluster)
|
nvplib.check_cluster_connectivity(cluster)
|
||||||
gateway_services = get_gateway_services(cluster)
|
gateway_services = get_gateway_services(cluster)
|
||||||
default_gateways = {
|
default_gateways = {
|
||||||
@ -90,24 +92,24 @@ def main(argv):
|
|||||||
errors = 0
|
errors = 0
|
||||||
for svc_type in default_gateways.keys():
|
for svc_type in default_gateways.keys():
|
||||||
for uuid in gateway_services[svc_type]:
|
for uuid in gateway_services[svc_type]:
|
||||||
print "\t\tGateway(%s) uuid: %s" % (svc_type, uuid)
|
print("\t\tGateway(%s) uuid: %s" % (svc_type, uuid))
|
||||||
if (default_gateways[svc_type] and
|
if (default_gateways[svc_type] and
|
||||||
default_gateways[svc_type] not in gateway_services):
|
default_gateways[svc_type] not in gateway_services):
|
||||||
print ("\t\t\tError: specified default %s gateway (%s) is "
|
print("\t\t\tError: specified default %s gateway (%s) is "
|
||||||
"missing from NVP Gateway Services!" % (svc_type,
|
"missing from NVP Gateway Services!" % (svc_type,
|
||||||
default_gateways[svc_type]))
|
default_gateways[svc_type]))
|
||||||
errors += 1
|
errors += 1
|
||||||
transport_zones = get_transport_zones(cluster)
|
transport_zones = get_transport_zones(cluster)
|
||||||
print "\tTransport zones: %s" % transport_zones
|
print("\tTransport zones: %s" % transport_zones)
|
||||||
if cfg.CONF.default_tz_uuid not in transport_zones:
|
if cfg.CONF.default_tz_uuid not in transport_zones:
|
||||||
print ("\t\tError: specified default transport zone "
|
print("\t\tError: specified default transport zone "
|
||||||
"(%s) is missing from NVP transport zones!"
|
"(%s) is missing from NVP transport zones!"
|
||||||
% cfg.CONF.default_tz_uuid)
|
% cfg.CONF.default_tz_uuid)
|
||||||
errors += 1
|
errors += 1
|
||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
print ("\nThere are %d errors with your configuration. "
|
print("\nThere are %d errors with your configuration. "
|
||||||
" Please, revise!" % errors)
|
" Please, revise!" % errors)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print "Done."
|
print("Done.")
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@ -356,10 +358,10 @@ class TaskManager():
|
|||||||
|
|
||||||
def show_pending_tasks(self):
|
def show_pending_tasks(self):
|
||||||
for task in self._tasks_queue:
|
for task in self._tasks_queue:
|
||||||
print str(task)
|
print(str(task))
|
||||||
for resource, tasks in self._tasks.iteritems():
|
for resource, tasks in self._tasks.iteritems():
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
print str(task)
|
print(str(task))
|
||||||
|
|
||||||
def count(self):
|
def count(self):
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -85,7 +85,6 @@ class NeutronDB(object):
|
|||||||
def update_network(self, tenant_id, net_id, param_data):
|
def update_network(self, tenant_id, net_id, param_data):
|
||||||
"""Rename a network."""
|
"""Rename a network."""
|
||||||
try:
|
try:
|
||||||
print param_data
|
|
||||||
net = db.network_update(net_id, tenant_id, **param_data)
|
net = db.network_update(net_id, tenant_id, **param_data)
|
||||||
LOG.debug("Updated network: %s", net.uuid)
|
LOG.debug("Updated network: %s", net.uuid)
|
||||||
net_dict = {}
|
net_dict = {}
|
||||||
|
@ -172,9 +172,6 @@ class TestNecAgent(TestNecAgentBase):
|
|||||||
self._check_report_state([dummy_vif] * 5, 5, fail_mode)
|
self._check_report_state([dummy_vif] * 5, 5, fail_mode)
|
||||||
self._check_report_state([], 0, fail_mode)
|
self._check_report_state([], 0, fail_mode)
|
||||||
|
|
||||||
print 'record_state', self.record_calls
|
|
||||||
print 'num_ports_hist', self.num_ports_hist
|
|
||||||
|
|
||||||
# Since loopingcall start is mocked, call_count is same as
|
# Since loopingcall start is mocked, call_count is same as
|
||||||
# the call count of check_report_state.
|
# the call count of check_report_state.
|
||||||
self.assertEqual(state_rpc.report_state.call_count, 4)
|
self.assertEqual(state_rpc.report_state.call_count, 4)
|
||||||
|
@ -427,7 +427,6 @@ class PFCIdConvertTest(base.BaseTestCase):
|
|||||||
|
|
||||||
def test_convert_tenant_id(self):
|
def test_convert_tenant_id(self):
|
||||||
ofc_t_id = self.generate_random_ids(1)
|
ofc_t_id = self.generate_random_ids(1)
|
||||||
print ofc_t_id
|
|
||||||
ret = self.driver.convert_ofc_tenant_id(self.ctx, ofc_t_id)
|
ret = self.driver.convert_ofc_tenant_id(self.ctx, ofc_t_id)
|
||||||
self.assertEqual(ret, '/tenants/%s' % ofc_t_id)
|
self.assertEqual(ret, '/tenants/%s' % ofc_t_id)
|
||||||
|
|
||||||
|
@ -241,7 +241,6 @@ class TremaFilterDriverTest(TremaDriverTestBase):
|
|||||||
'status': "ACTIVE"}
|
'status': "ACTIVE"}
|
||||||
if filter_dict:
|
if filter_dict:
|
||||||
f.update(filter_dict)
|
f.update(filter_dict)
|
||||||
print 'filter=%s' % f
|
|
||||||
|
|
||||||
net_path = "/networks/%s" % n
|
net_path = "/networks/%s" % n
|
||||||
|
|
||||||
@ -462,8 +461,7 @@ class TremaIdConvertTestBase(base.BaseTestCase):
|
|||||||
|
|
||||||
ret = self.driver.convert_ofc_port_id(self.ctx, ofc_p_id, t_id, n_id)
|
ret = self.driver.convert_ofc_port_id(self.ctx, ofc_p_id, t_id, n_id)
|
||||||
exp = port_path_template % {'network': ofc_n_id, 'port': ofc_p_id}
|
exp = port_path_template % {'network': ofc_n_id, 'port': ofc_p_id}
|
||||||
print 'exp=', exp
|
|
||||||
print 'ret=', ret
|
|
||||||
self.assertEqual(ret, exp)
|
self.assertEqual(ret, exp)
|
||||||
self.mox.VerifyAll()
|
self.mox.VerifyAll()
|
||||||
|
|
||||||
|
@ -125,9 +125,6 @@ class VcnsDriverTaskManagerTestCase(base.BaseTestCase):
|
|||||||
|
|
||||||
task.wait(TaskState.RESULT)
|
task.wait(TaskState.RESULT)
|
||||||
|
|
||||||
if 'error' in userdata:
|
|
||||||
print userdata['error']
|
|
||||||
|
|
||||||
self.assertTrue(userdata['result'])
|
self.assertTrue(userdata['result'])
|
||||||
|
|
||||||
def test_task_manager_task_sync_exec_process_state(self):
|
def test_task_manager_task_sync_exec_process_state(self):
|
||||||
@ -173,11 +170,6 @@ class VcnsDriverTaskManagerTestCase(base.BaseTestCase):
|
|||||||
|
|
||||||
last_task.wait(TaskState.RESULT)
|
last_task.wait(TaskState.RESULT)
|
||||||
|
|
||||||
for task in tasks:
|
|
||||||
if 'error' in task.userdata:
|
|
||||||
print "Task %s failed: " % (
|
|
||||||
tasks.name, tasks.userdata['error'])
|
|
||||||
|
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
self.assertTrue(task.userdata['result'])
|
self.assertTrue(task.userdata['result'])
|
||||||
|
|
||||||
|
@ -271,7 +271,6 @@ class TestAllowedAddressPairs(AllowedAddressPairDBTestCase):
|
|||||||
port_security_enabled=True,
|
port_security_enabled=True,
|
||||||
allowed_address_pairs=address_pairs)
|
allowed_address_pairs=address_pairs)
|
||||||
port = self.deserialize(self.fmt, res)
|
port = self.deserialize(self.fmt, res)
|
||||||
print port
|
|
||||||
update_port = {'port': {psec.PORTSECURITY: False}}
|
update_port = {'port': {psec.PORTSECURITY: False}}
|
||||||
# If plugin implements security groups we also need to remove
|
# If plugin implements security groups we also need to remove
|
||||||
# the security group on port.
|
# the security group on port.
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
"""
|
"""
|
||||||
Utility methods for working with WSGI servers
|
Utility methods for working with WSGI servers
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
@ -894,15 +896,15 @@ class Debug(Middleware):
|
|||||||
|
|
||||||
@webob.dec.wsgify
|
@webob.dec.wsgify
|
||||||
def __call__(self, req):
|
def __call__(self, req):
|
||||||
print ("*" * 40) + " REQUEST ENVIRON"
|
print(("*" * 40) + " REQUEST ENVIRON")
|
||||||
for key, value in req.environ.items():
|
for key, value in req.environ.items():
|
||||||
print key, "=", value
|
print(key, "=", value)
|
||||||
print
|
print
|
||||||
resp = req.get_response(self.application)
|
resp = req.get_response(self.application)
|
||||||
|
|
||||||
print ("*" * 40) + " RESPONSE HEADERS"
|
print(("*" * 40) + " RESPONSE HEADERS")
|
||||||
for (key, value) in resp.headers.iteritems():
|
for (key, value) in resp.headers.iteritems():
|
||||||
print key, "=", value
|
print(key, "=", value)
|
||||||
print
|
print
|
||||||
|
|
||||||
resp.app_iter = self.print_generator(resp.app_iter)
|
resp.app_iter = self.print_generator(resp.app_iter)
|
||||||
@ -912,7 +914,7 @@ class Debug(Middleware):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def print_generator(app_iter):
|
def print_generator(app_iter):
|
||||||
"""Print contents of a wrapper string iterator when iterated."""
|
"""Print contents of a wrapper string iterator when iterated."""
|
||||||
print ("*" * 40) + " BODY"
|
print(("*" * 40) + " BODY")
|
||||||
for part in app_iter:
|
for part in app_iter:
|
||||||
sys.stdout.write(part)
|
sys.stdout.write(part)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import compiler
|
import compiler
|
||||||
import imp
|
import imp
|
||||||
@ -56,15 +57,14 @@ class Visitor(object):
|
|||||||
if is_localized(node):
|
if is_localized(node):
|
||||||
for (checker, msg) in self.msg_format_checkers:
|
for (checker, msg) in self.msg_format_checkers:
|
||||||
if checker(node):
|
if checker(node):
|
||||||
print >> sys.stderr, (
|
print('%s:%d %s: %s Error: %s' %
|
||||||
'%s:%d %s: %s' %
|
|
||||||
(self.filename, node.lineno,
|
(self.filename, node.lineno,
|
||||||
self.lines[node.lineno - 1][:-1],
|
self.lines[node.lineno - 1][:-1], msg),
|
||||||
"Error: %s" % msg))
|
file=sys.stderr)
|
||||||
self.error = 1
|
self.error = 1
|
||||||
return
|
return
|
||||||
if debug:
|
if debug:
|
||||||
print ('%s:%d %s: %s' %
|
print('%s:%d %s: %s' %
|
||||||
(self.filename, node.lineno,
|
(self.filename, node.lineno,
|
||||||
self.lines[node.lineno - 1][:-1],
|
self.lines[node.lineno - 1][:-1],
|
||||||
"Pass"))
|
"Pass"))
|
||||||
@ -73,26 +73,25 @@ class Visitor(object):
|
|||||||
if predicate(node):
|
if predicate(node):
|
||||||
if action == 'skip':
|
if action == 'skip':
|
||||||
if debug:
|
if debug:
|
||||||
print ('%s:%d %s: %s' %
|
print('%s:%d %s: %s' %
|
||||||
(self.filename, node.lineno,
|
(self.filename, node.lineno,
|
||||||
self.lines[node.lineno - 1][:-1],
|
self.lines[node.lineno - 1][:-1],
|
||||||
"Pass"))
|
"Pass"))
|
||||||
return
|
return
|
||||||
elif action == 'error':
|
elif action == 'error':
|
||||||
print >> sys.stderr, (
|
print('%s:%d %s: %s Error: %s' %
|
||||||
'%s:%d %s: %s' %
|
|
||||||
(self.filename, node.lineno,
|
(self.filename, node.lineno,
|
||||||
self.lines[node.lineno - 1][:-1],
|
self.lines[node.lineno - 1][:-1], msg),
|
||||||
"Error: %s" % msg))
|
file=sys.stderr)
|
||||||
self.error = 1
|
self.error = 1
|
||||||
return
|
return
|
||||||
elif action == 'warn':
|
elif action == 'warn':
|
||||||
print ('%s:%d %s: %s' %
|
print('%s:%d %s: %s' %
|
||||||
(self.filename, node.lineno,
|
(self.filename, node.lineno,
|
||||||
self.lines[node.lineno - 1][:-1],
|
self.lines[node.lineno - 1][:-1],
|
||||||
"Warn: %s" % msg))
|
"Warn: %s" % msg))
|
||||||
return
|
return
|
||||||
print >> sys.stderr, 'Predicate with wrong action!'
|
print('Predicate with wrong action!', file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
def is_file_in_black_list(black_list, f):
|
def is_file_in_black_list(black_list, f):
|
||||||
@ -120,7 +119,7 @@ if __name__ == '__main__':
|
|||||||
try:
|
try:
|
||||||
cfg_mod = imp.load_source('', cfg_path)
|
cfg_mod = imp.load_source('', cfg_path)
|
||||||
except Exception:
|
except Exception:
|
||||||
print >> sys.stderr, "Load cfg module failed"
|
print("Load cfg module failed", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
i18n_msg_predicates = cfg_mod.i18n_msg_predicates
|
i18n_msg_predicates = cfg_mod.i18n_msg_predicates
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
"""
|
"""
|
||||||
Installation script for Neutron's development virtualenv
|
Installation script for Neutron's development virtualenv
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -50,7 +51,7 @@ def print_help():
|
|||||||
|
|
||||||
Also, make test will automatically use the virtualenv.
|
Also, make test will automatically use the virtualenv.
|
||||||
"""
|
"""
|
||||||
print help
|
print(help)
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
|
Loading…
Reference in New Issue
Block a user