# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import locale
""" return an etree object representing fixed (static) networking
"""
name="openstack")
name="default")
name="netcfg")
value="DefaultFixed")
name="default")
if not route:
# for no-gateway case
if ip_version == 4:
type="ipv4_interface",
if addrtype == "static":
else:
else:
if addrtype == "static":
type="ipv6_interface",
type="ipv6_interface",
else:
type="ipv6_interface",
if host_routes:
# create the host-routes profile
if hr_ip_version == 4:
hr_pg_type = "ipv4_route"
hr_pval_type = "net_address_v4"
else:
hr_pg_type = "ipv6_route"
hr_pval_type = "net_address_v6"
# create DNS profile for static configurations
name="config")
name="nameserver")
for entry in nameservers:
name="search")
return svcbundle
""" return an etree object representing the root account
"""
name="openstack")
name="default")
name="root_account")
value="normal")
if password is not None:
else:
value='NP')
if expire is not None:
if sshkey is not None:
name="ssh_public_keys")
return svcbundle
""" return an etree object to set a public SSH key for root
"""
name="openstack")
name="default")
name="root_account")
name="ssh_public_keys")
return svcbundle
""" return an etree object representing the instance's hostname
"""
name="openstack")
name="node")
name="config")
return svcbundle
""" create a file containing the proper XML headers and encoding for a
given etree object
"""
if encoding == "646":
# The C locale on Solaris is returned as '646'. Set it to 'US-ASCII'
# instead
encoding = 'US-ASCII'
# insert a comment just under the doctype line