def validate_schema(xml, schema_name): if type(xml) is str: xml = etree.fromstring(xml) schema_path = os.path.join(utils.novadir(), 'nova/api/openstack/schemas/v1.1/%s.rng' % schema_name) schema_doc = etree.parse(schema_path) relaxng = etree.RelaxNG(schema_doc) relaxng.assertValid(xml)
def run_ajaxterm(cmd, token, port): """Run ajaxterm :param cmd: Command to connect to :param token: Token to require for authentication :param port: Port to run on """ cmd = ['%s/tools/ajaxterm/ajaxterm.py' % utils.novadir(), '--command', cmd, '-t', token, '-p', port] execute(*cmd)
def validate_schema(xml, schema_name, version="v1.1"): if isinstance(xml, str): xml = etree.fromstring(xml) base_path = "nova/api/openstack/compute/schemas/" if schema_name not in ("atom", "atom-link"): base_path += "%s/" % version schema_path = os.path.join(utils.novadir(), "%s%s.rng" % (base_path, schema_name)) schema_doc = etree.parse(schema_path) relaxng = etree.RelaxNG(schema_doc) relaxng.assertValid(xml)
def validate_schema(xml, schema_name): if isinstance(xml, str): xml = etree.fromstring(xml) base_path = 'nova/api/openstack/compute/schemas/v1.1/' if schema_name in ('atom', 'atom-link'): base_path = 'nova/api/openstack/compute/schemas/' schema_path = os.path.join(utils.novadir(), '%s%s.rng' % (base_path, schema_name)) schema_doc = etree.parse(schema_path) relaxng = etree.RelaxNG(schema_doc) relaxng.assertValid(xml)
def validate_schema(xml, schema_name, version='v1.1'): if isinstance(xml, str): xml = etree.fromstring(xml) base_path = 'nova/api/openstack/compute/schemas/' if schema_name not in ('atom', 'atom-link'): base_path += '%s/' % version schema_path = os.path.join(utils.novadir(), '%s%s.rng' % (base_path, schema_name)) schema_doc = etree.parse(schema_path) relaxng = etree.RelaxNG(schema_doc) relaxng.assertValid(xml)
def validate_schema(xml, schema_name): if type(xml) is str: xml = etree.fromstring(xml) base_path = 'nova/api/openstack/v2/schemas/v1.1/' if schema_name in ('atom', 'atom-link'): base_path = 'nova/api/openstack/v2/schemas/' schema_path = os.path.join(utils.novadir(), '%s%s.rng' % (base_path, schema_name)) schema_doc = etree.parse(schema_path) relaxng = etree.RelaxNG(schema_doc) relaxng.assertValid(xml)
def run_ajaxterm(cmd, token, port): """Run ajaxterm :param cmd: Command to connect to :param token: Token to require for authentication :param port: Port to run on """ cmd = [ '%s/tools/ajaxterm/ajaxterm.py' % utils.novadir(), '--command', cmd, '-t', token, '-p', port ] execute(*cmd)