Add support for generating cloudbase-init configuration sample
This package adds a central place where all the config options of cloudbase-init can be easily maintained. Change-Id: Idfc1aea2d637a0124be17c90bcf98450769bc76f
This commit is contained in:
parent
b46605f71f
commit
6c6ef0e11a
24
cloudbaseinit/conf/__init__.py
Normal file
24
cloudbaseinit/conf/__init__.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
from oslo_log import log
|
||||||
|
|
||||||
|
from cloudbaseinit.conf import factory
|
||||||
|
|
||||||
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
log.register_options(CONF)
|
||||||
|
for _OPT_CLS in factory.get_options():
|
||||||
|
_OPT_CLS(CONF).register()
|
42
cloudbaseinit/conf/base.py
Normal file
42
cloudbaseinit/conf/base.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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 abc
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
|
class Options(object):
|
||||||
|
|
||||||
|
"""Contact class for all the collections of config options."""
|
||||||
|
|
||||||
|
def __init__(self, config, group="DEFAULT"):
|
||||||
|
self._config = config
|
||||||
|
self._group_name = group
|
||||||
|
|
||||||
|
@property
|
||||||
|
def group_name(self):
|
||||||
|
"""The group name for the current options."""
|
||||||
|
return self._group_name
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def register(self):
|
||||||
|
"""Register the current options to the global ConfigOpts object."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def list(self):
|
||||||
|
"""Return a list which contains all the available options."""
|
||||||
|
pass
|
68
cloudbaseinit/conf/cloudconfig.py
Normal file
68
cloudbaseinit/conf/cloudconfig.py
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""Config options available for the cloud config metadata service."""
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from cloudbaseinit.conf import base as conf_base
|
||||||
|
from cloudbaseinit import constant
|
||||||
|
|
||||||
|
|
||||||
|
class CloudConfigOptions(conf_base.Options):
|
||||||
|
|
||||||
|
"""Config options available for the cloud config metadata service."""
|
||||||
|
|
||||||
|
def __init__(self, config):
|
||||||
|
super(CloudConfigOptions, self).__init__(config, group="config_drive")
|
||||||
|
self._options = [
|
||||||
|
cfg.BoolOpt(
|
||||||
|
"raw_hdd", default=True,
|
||||||
|
help="Look for an ISO config drive in raw HDDs",
|
||||||
|
deprecated_name="config_drive_raw_hhd",
|
||||||
|
deprecated_group="DEFAULT",
|
||||||
|
deprecated_for_removal=True),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
"cdrom", default=True,
|
||||||
|
help="Look for a config drive in the attached cdrom drives",
|
||||||
|
deprecated_name="config_drive_cdrom",
|
||||||
|
deprecated_group="DEFAULT",
|
||||||
|
deprecated_for_removal=True),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
"vfat", default=True,
|
||||||
|
help="Look for a config drive in VFAT filesystems",
|
||||||
|
deprecated_name="config_drive_vfat",
|
||||||
|
deprecated_group="DEFAULT",
|
||||||
|
deprecated_for_removal=True),
|
||||||
|
cfg.ListOpt(
|
||||||
|
"types", default=list(constant.CD_TYPES),
|
||||||
|
help="Supported formats of a configuration drive",
|
||||||
|
deprecated_name="config_drive_types",
|
||||||
|
deprecated_group="DEFAULT",),
|
||||||
|
cfg.ListOpt(
|
||||||
|
"locations", default=list(constant.CD_LOCATIONS),
|
||||||
|
deprecated_name="config_drive_locations",
|
||||||
|
deprecated_group="DEFAULT",
|
||||||
|
help="Supported configuration drive locations"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def register(self):
|
||||||
|
"""Register the current options to the global ConfigOpts object."""
|
||||||
|
group = cfg.OptGroup(self._group_name, title='Cloud Config Options')
|
||||||
|
self._config.register_group(group)
|
||||||
|
self._config.register_opts(self._options, group=group)
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
"""Return a list which contains all the available options."""
|
||||||
|
return self._options
|
44
cloudbaseinit/conf/cloudstack.py
Normal file
44
cloudbaseinit/conf/cloudstack.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""Config options available for the CloudStack metadata service."""
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from cloudbaseinit.conf import base as conf_base
|
||||||
|
|
||||||
|
|
||||||
|
class CloudStackOptions(conf_base.Options):
|
||||||
|
|
||||||
|
"""Config options available for the CloudStack metadata service."""
|
||||||
|
|
||||||
|
def __init__(self, config):
|
||||||
|
super(CloudStackOptions, self).__init__(config, group="cloudstack")
|
||||||
|
self._options = [
|
||||||
|
cfg.StrOpt(
|
||||||
|
"metadata_base_url", default="http://10.1.1.1/",
|
||||||
|
help="The base URL where the service looks for metadata",
|
||||||
|
deprecated_name="cloudstack_metadata_ip",
|
||||||
|
deprecated_group="DEFAULT"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def register(self):
|
||||||
|
"""Register the current options to the global ConfigOpts object."""
|
||||||
|
group = cfg.OptGroup(self.group_name, title='CloudStack Options')
|
||||||
|
self._config.register_group(group)
|
||||||
|
self._config.register_opts(self._options, group=group)
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
"""Return a list which contains all the available options."""
|
||||||
|
return self._options
|
200
cloudbaseinit/conf/default.py
Normal file
200
cloudbaseinit/conf/default.py
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
"""Config options available all across the project."""
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from cloudbaseinit.conf import base as conf_base
|
||||||
|
from cloudbaseinit import constant
|
||||||
|
|
||||||
|
|
||||||
|
class GlobalOptions(conf_base.Options):
|
||||||
|
|
||||||
|
"""Config options available all across the project."""
|
||||||
|
|
||||||
|
def __init__(self, config):
|
||||||
|
super(GlobalOptions, self).__init__(config, group="DEFAULT")
|
||||||
|
self._options = [
|
||||||
|
cfg.BoolOpt(
|
||||||
|
'allow_reboot', default=True,
|
||||||
|
help='Allows OS reboots requested by plugins'),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
'stop_service_on_exit', default=True,
|
||||||
|
help='In case of execution as a service, specifies if the '
|
||||||
|
'service must be gracefully stopped before exiting'),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
'check_latest_version', default=True,
|
||||||
|
help='Check if there is a newer version of cloudbase-init '
|
||||||
|
'available. If this option is activated, a log '
|
||||||
|
'message will be emitted if there is a newer version '
|
||||||
|
'available.'),
|
||||||
|
cfg.IntOpt(
|
||||||
|
'retry_count', default=5,
|
||||||
|
help='Max. number of attempts for fetching metadata in '
|
||||||
|
'case of transient errors'),
|
||||||
|
cfg.FloatOpt(
|
||||||
|
'retry_count_interval', default=4,
|
||||||
|
help='Interval between attempts in case of transient errors, '
|
||||||
|
'expressed in seconds'),
|
||||||
|
cfg.StrOpt(
|
||||||
|
'mtools_path', default=None,
|
||||||
|
help='Path to "mtools" program suite, used for interacting '
|
||||||
|
'with VFAT filesystems'),
|
||||||
|
cfg.StrOpt(
|
||||||
|
'bsdtar_path', default='bsdtar.exe',
|
||||||
|
help='Path to "bsdtar", used to extract ISO ConfigDrive '
|
||||||
|
'files'),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
'netbios_host_name_compatibility', default=True,
|
||||||
|
help='Truncates the hostname to 15 characters for Netbios '
|
||||||
|
'compatibility'),
|
||||||
|
cfg.StrOpt(
|
||||||
|
'logging_serial_port_settings', default=None,
|
||||||
|
help='Serial port logging settings. Format: '
|
||||||
|
'"port,baudrate,parity,bytesize", e.g.: '
|
||||||
|
'"COM1,115200,N,8". Set to None (default) to disable.'),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
'activate_windows', default=False,
|
||||||
|
help='Activates Windows automatically'),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
'winrm_enable_basic_auth', default=True,
|
||||||
|
help='Enables basic authentication for the WinRM '
|
||||||
|
'HTTPS listener'),
|
||||||
|
cfg.ListOpt(
|
||||||
|
'volumes_to_extend', default=None,
|
||||||
|
help='List of volumes that need to be extended '
|
||||||
|
'if contiguous space is available on the disk. '
|
||||||
|
'By default all the available volumes can be extended. '
|
||||||
|
'Volumes must be specified using a comma separated list '
|
||||||
|
'of volume indexes, e.g.: "1,2"'),
|
||||||
|
cfg.StrOpt(
|
||||||
|
'local_scripts_path', default=None,
|
||||||
|
help='Path location containing scripts to be executed when '
|
||||||
|
'the plugin runs'),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
'mtu_use_dhcp_config', default=True,
|
||||||
|
help='Configures the network interfaces MTU based on the '
|
||||||
|
'values provided via DHCP'),
|
||||||
|
cfg.StrOpt(
|
||||||
|
'username', default='Admin', help='User to be added to the '
|
||||||
|
'system or updated if already existing'),
|
||||||
|
cfg.ListOpt(
|
||||||
|
'groups', default=['Administrators'],
|
||||||
|
help='List of local groups to which the user specified in '
|
||||||
|
'"username" will be added'),
|
||||||
|
cfg.StrOpt(
|
||||||
|
'heat_config_dir', default='C:\\cfn',
|
||||||
|
help='The directory where the Heat configuration files must '
|
||||||
|
'be saved'),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
'ntp_use_dhcp_config', default=False,
|
||||||
|
help='Configures NTP client time synchronization using '
|
||||||
|
'the NTP servers provided via DHCP'),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
'inject_user_password', default=True,
|
||||||
|
help='Set the password provided in the configuration. '
|
||||||
|
'If False or no password is provided, a random one '
|
||||||
|
'will be set'),
|
||||||
|
cfg.StrOpt(
|
||||||
|
'first_logon_behaviour',
|
||||||
|
default=constant.CLEAR_TEXT_INJECTED_ONLY,
|
||||||
|
choices=constant.LOGON_PASSWORD_CHANGE_OPTIONS,
|
||||||
|
help='Control the behaviour of what happens at '
|
||||||
|
'next logon. If this option is set to `always`, '
|
||||||
|
'then the user will be forced to change the password '
|
||||||
|
'at next logon. If it is set to '
|
||||||
|
'`clear_text_injected_only`, '
|
||||||
|
'then the user will have to change the password only if '
|
||||||
|
'the password is a clear text password, coming from the '
|
||||||
|
'metadata. The last option is `no`, when the user is '
|
||||||
|
'never forced to change the password.'),
|
||||||
|
cfg.ListOpt(
|
||||||
|
'metadata_services',
|
||||||
|
default=[
|
||||||
|
'cloudbaseinit.metadata.services.httpservice.HttpService',
|
||||||
|
'cloudbaseinit.metadata.services'
|
||||||
|
'.configdrive.ConfigDriveService',
|
||||||
|
'cloudbaseinit.metadata.services.ec2service.EC2Service',
|
||||||
|
'cloudbaseinit.metadata.services'
|
||||||
|
'.maasservice.MaaSHttpService',
|
||||||
|
'cloudbaseinit.metadata.services.cloudstack.CloudStack',
|
||||||
|
'cloudbaseinit.metadata.services'
|
||||||
|
'.opennebulaservice.OpenNebulaService',
|
||||||
|
],
|
||||||
|
help='List of enabled metadata service classes, '
|
||||||
|
'to be tested for availability in the provided order. '
|
||||||
|
'The first available service will be used to retrieve '
|
||||||
|
'metadata'),
|
||||||
|
cfg.ListOpt(
|
||||||
|
'plugins',
|
||||||
|
default=[
|
||||||
|
'cloudbaseinit.plugins.common.mtu.MTUPlugin',
|
||||||
|
'cloudbaseinit.plugins.windows.ntpclient'
|
||||||
|
'.NTPClientPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.sethostname'
|
||||||
|
'.SetHostNamePlugin',
|
||||||
|
'cloudbaseinit.plugins.windows.createuser'
|
||||||
|
'.CreateUserPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.networkconfig'
|
||||||
|
'.NetworkConfigPlugin',
|
||||||
|
'cloudbaseinit.plugins.windows.licensing'
|
||||||
|
'.WindowsLicensingPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.sshpublickeys'
|
||||||
|
'.SetUserSSHPublicKeysPlugin',
|
||||||
|
'cloudbaseinit.plugins.windows.extendvolumes'
|
||||||
|
'.ExtendVolumesPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.userdata.UserDataPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.setuserpassword.'
|
||||||
|
'SetUserPasswordPlugin',
|
||||||
|
'cloudbaseinit.plugins.windows.winrmlistener.'
|
||||||
|
'ConfigWinRMListenerPlugin',
|
||||||
|
'cloudbaseinit.plugins.windows.winrmcertificateauth.'
|
||||||
|
'ConfigWinRMCertificateAuthPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.localscripts'
|
||||||
|
'.LocalScriptsPlugin',
|
||||||
|
],
|
||||||
|
help='List of enabled plugin classes, '
|
||||||
|
'to be executed in the provided order'),
|
||||||
|
cfg.ListOpt(
|
||||||
|
'user_data_plugins',
|
||||||
|
default=[
|
||||||
|
'cloudbaseinit.plugins.common.userdataplugins.parthandler.'
|
||||||
|
'PartHandlerPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.userdataplugins.cloudconfig.'
|
||||||
|
'CloudConfigPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.userdataplugins'
|
||||||
|
'.cloudboothook.CloudBootHookPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.userdataplugins.shellscript.'
|
||||||
|
'ShellScriptPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.userdataplugins'
|
||||||
|
'.multipartmixed.MultipartMixedPlugin',
|
||||||
|
'cloudbaseinit.plugins.common.userdataplugins.heat.'
|
||||||
|
'HeatPlugin',
|
||||||
|
],
|
||||||
|
help='List of enabled userdata content plugins'),
|
||||||
|
cfg.ListOpt(
|
||||||
|
'cloud_config_plugins', default=[],
|
||||||
|
help='List which contains the name of the cloud config '
|
||||||
|
'plugins ordered by priority.'),
|
||||||
|
]
|
||||||
|
|
||||||
|
def register(self):
|
||||||
|
"""Register the current options to the global ConfigOpts object."""
|
||||||
|
self._config.register_opts(self._options)
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
"""Return a list which contains all the available options."""
|
||||||
|
return self._options
|
49
cloudbaseinit/conf/ec2.py
Normal file
49
cloudbaseinit/conf/ec2.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""Config options available for the EC2 metadata service."""
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from cloudbaseinit.conf import base as conf_base
|
||||||
|
|
||||||
|
|
||||||
|
class EC2Options(conf_base.Options):
|
||||||
|
|
||||||
|
"""Config options available for the EC2 metadata service."""
|
||||||
|
|
||||||
|
def __init__(self, config):
|
||||||
|
super(EC2Options, self).__init__(config, group="ec2")
|
||||||
|
self._options = [
|
||||||
|
cfg.StrOpt(
|
||||||
|
"metadata_base_url", default="http://169.254.169.254/",
|
||||||
|
help="The base URL where the service looks for metadata",
|
||||||
|
deprecated_name="ec2_metadata_base_url",
|
||||||
|
deprecated_group="DEFAULT"),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
"add_metadata_private_ip_route", default=True,
|
||||||
|
help="Add a route for the metadata ip address to the gateway",
|
||||||
|
deprecated_name="ec2_add_metadata_private_ip_route",
|
||||||
|
deprecated_group="DEFAULT"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def register(self):
|
||||||
|
"""Register the current options to the global ConfigOpts object."""
|
||||||
|
group = cfg.OptGroup(self.group_name, title='EC2 Options')
|
||||||
|
self._config.register_group(group)
|
||||||
|
self._config.register_opts(self._options, group=group)
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
"""Return a list which contains all the available options."""
|
||||||
|
return self._options
|
30
cloudbaseinit/conf/factory.py
Normal file
30
cloudbaseinit/conf/factory.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
from cloudbaseinit.utils import classloader
|
||||||
|
|
||||||
|
_OPT_PATHS = (
|
||||||
|
'cloudbaseinit.conf.cloudconfig.CloudConfigOptions',
|
||||||
|
'cloudbaseinit.conf.cloudstack.CloudStackOptions',
|
||||||
|
'cloudbaseinit.conf.default.GlobalOptions',
|
||||||
|
'cloudbaseinit.conf.ec2.EC2Options',
|
||||||
|
'cloudbaseinit.conf.maas.MAASOptions',
|
||||||
|
'cloudbaseinit.conf.openstack.OpenStackOptions',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_options():
|
||||||
|
"""Return a list of all the available `Options` subclasses."""
|
||||||
|
loader = classloader.ClassLoader()
|
||||||
|
return [loader.load_class(class_path) for class_path in _OPT_PATHS]
|
59
cloudbaseinit/conf/maas.py
Normal file
59
cloudbaseinit/conf/maas.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""Config options available for the MAAS service."""
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from cloudbaseinit.conf import base as conf_base
|
||||||
|
|
||||||
|
|
||||||
|
class MAASOptions(conf_base.Options):
|
||||||
|
|
||||||
|
"""Config options available for the MAAS metadata service."""
|
||||||
|
|
||||||
|
def __init__(self, config):
|
||||||
|
super(MAASOptions, self).__init__(config, group="maas")
|
||||||
|
self._options = [
|
||||||
|
cfg.StrOpt("metadata_base_url", default=None,
|
||||||
|
help="The base URL for MaaS metadata",
|
||||||
|
deprecated_name="maas_metadata_url",
|
||||||
|
deprecated_group="DEFAULT"),
|
||||||
|
cfg.StrOpt("oauth_consumer_key", default="",
|
||||||
|
help="The MaaS OAuth consumer key",
|
||||||
|
deprecated_name="maas_oauth_consumer_key",
|
||||||
|
deprecated_group="DEFAULT"),
|
||||||
|
cfg.StrOpt("oauth_consumer_secret", default="",
|
||||||
|
help="The MaaS OAuth consumer secret",
|
||||||
|
deprecated_name="maas_oauth_consumer_secret",
|
||||||
|
deprecated_group="DEFAULT"),
|
||||||
|
cfg.StrOpt("oauth_token_key", default="",
|
||||||
|
help="The MaaS OAuth token key",
|
||||||
|
deprecated_name="maas_oauth_token_key",
|
||||||
|
deprecated_group="DEFAULT"),
|
||||||
|
cfg.StrOpt("oauth_token_secret", default="",
|
||||||
|
help="The MaaS OAuth token secret",
|
||||||
|
deprecated_name="maas_oauth_token_secret",
|
||||||
|
deprecated_group="DEFAULT"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def register(self):
|
||||||
|
"""Register the current options to the global ConfigOpts object."""
|
||||||
|
group = cfg.OptGroup(self.group_name, title='MAAS Options')
|
||||||
|
self._config.register_group(group)
|
||||||
|
self._config.register_opts(self._options, group=group)
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
"""Return a list which contains all the available options."""
|
||||||
|
return self._options
|
47
cloudbaseinit/conf/openstack.py
Normal file
47
cloudbaseinit/conf/openstack.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""Config options available for the OpenStack metadata service."""
|
||||||
|
|
||||||
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
from cloudbaseinit.conf import base as conf_base
|
||||||
|
|
||||||
|
|
||||||
|
class OpenStackOptions(conf_base.Options):
|
||||||
|
|
||||||
|
"""Config options available for the OpenStack metadata service."""
|
||||||
|
|
||||||
|
def __init__(self, config):
|
||||||
|
super(OpenStackOptions, self).__init__(config, group="openstack")
|
||||||
|
self._options = [
|
||||||
|
cfg.StrOpt(
|
||||||
|
"metadata_base_url", default="http://169.254.169.254/",
|
||||||
|
help="The base URL where the service looks for metadata",
|
||||||
|
deprecated_group="DEFAULT"),
|
||||||
|
cfg.BoolOpt(
|
||||||
|
"add_metadata_private_ip_route", default=True,
|
||||||
|
help="Add a route for the metadata ip address to the gateway",
|
||||||
|
deprecated_group="DEFAULT"),
|
||||||
|
]
|
||||||
|
|
||||||
|
def register(self):
|
||||||
|
"""Register the current options to the global ConfigOpts object."""
|
||||||
|
group = cfg.OptGroup(self.group_name, title='OpenStack Options')
|
||||||
|
self._config.register_group(group)
|
||||||
|
self._config.register_opts(self._options, group=group)
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
"""Return a list which contains all the available options."""
|
||||||
|
return self._options
|
34
cloudbaseinit/conf/opts.py
Normal file
34
cloudbaseinit/conf/opts.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
"""
|
||||||
|
This is the single point of entry to generate the sample configuration
|
||||||
|
file for Cloudbase-Init.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import collections
|
||||||
|
|
||||||
|
from cloudbaseinit.conf import base as conf_base
|
||||||
|
from cloudbaseinit.conf import factory as conf_factory
|
||||||
|
|
||||||
|
|
||||||
|
def get_options():
|
||||||
|
"""Collect all the options info from the other modules."""
|
||||||
|
options = collections.defaultdict(list)
|
||||||
|
for opt_class in conf_factory.get_options():
|
||||||
|
if not issubclass(opt_class, conf_base.Options):
|
||||||
|
continue
|
||||||
|
config_options = opt_class(None)
|
||||||
|
options[config_options.group_name].extend(config_options.list())
|
||||||
|
return [(key, value) for key, value in options.items()]
|
36
cloudbaseinit/constant.py
Normal file
36
cloudbaseinit/constant.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Copyright 2016 Cloudbase Solutions Srl
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# Config Drive types and possible locations.
|
||||||
|
CD_TYPES = {
|
||||||
|
"vfat", # Visible device (with partition table).
|
||||||
|
"iso", # "Raw" format containing ISO bytes.
|
||||||
|
}
|
||||||
|
CD_LOCATIONS = {
|
||||||
|
# Look into optical units devices. Only an ISO format could
|
||||||
|
# be used here (vfat ignored).
|
||||||
|
"cdrom",
|
||||||
|
# Search through physical disks for raw ISO content or vfat filesystems
|
||||||
|
# containing configuration drive's content.
|
||||||
|
"hdd",
|
||||||
|
# Search through partitions for raw ISO content or through volumes
|
||||||
|
# containing configuration drive's content.
|
||||||
|
"partition",
|
||||||
|
}
|
||||||
|
|
||||||
|
CLEAR_TEXT_INJECTED_ONLY = 'clear_text_injected_only'
|
||||||
|
ALWAYS_CHANGE = 'always'
|
||||||
|
NEVER_CHANGE = 'no'
|
||||||
|
LOGON_PASSWORD_CHANGE_OPTIONS = [CLEAR_TEXT_INJECTED_ONLY, NEVER_CHANGE,
|
||||||
|
ALWAYS_CHANGE]
|
@ -15,30 +15,17 @@
|
|||||||
import functools
|
import functools
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata import factory as metadata_factory
|
from cloudbaseinit.metadata import factory as metadata_factory
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.plugins.common import base as plugins_base
|
from cloudbaseinit.plugins.common import base as plugins_base
|
||||||
from cloudbaseinit.plugins import factory as plugins_factory
|
from cloudbaseinit.plugins import factory as plugins_factory
|
||||||
from cloudbaseinit import version
|
from cloudbaseinit import version
|
||||||
|
|
||||||
opts = [
|
|
||||||
cfg.BoolOpt('allow_reboot', default=True, help='Allows OS reboots '
|
|
||||||
'requested by plugins'),
|
|
||||||
cfg.BoolOpt('stop_service_on_exit', default=True, help='In case of '
|
|
||||||
'execution as a service, specifies if the service '
|
|
||||||
'must be gracefully stopped before exiting'),
|
|
||||||
cfg.BoolOpt('check_latest_version', default=True, help='Check if '
|
|
||||||
'there is a newer version of cloudbase-init available. '
|
|
||||||
'If this option is activated, a log message will be '
|
|
||||||
'emitted if there is a newer version available.')
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,33 +12,14 @@
|
|||||||
# 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 oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
from cloudbaseinit.utils import classloader
|
from cloudbaseinit.utils import classloader
|
||||||
|
|
||||||
|
|
||||||
opts = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.ListOpt(
|
|
||||||
'metadata_services',
|
|
||||||
default=[
|
|
||||||
'cloudbaseinit.metadata.services.httpservice.HttpService',
|
|
||||||
'cloudbaseinit.metadata.services.configdrive.ConfigDriveService',
|
|
||||||
'cloudbaseinit.metadata.services.ec2service.EC2Service',
|
|
||||||
'cloudbaseinit.metadata.services.maasservice.MaaSHttpService',
|
|
||||||
'cloudbaseinit.metadata.services.cloudstack.CloudStack',
|
|
||||||
'cloudbaseinit.metadata.services'
|
|
||||||
'.opennebulaservice.OpenNebulaService',
|
|
||||||
],
|
|
||||||
help='List of enabled metadata service classes, '
|
|
||||||
'to be tested for availability in the provided order. '
|
|
||||||
'The first available service will be used to retrieve '
|
|
||||||
'metadata')
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,25 +19,13 @@ import gzip
|
|||||||
import io
|
import io
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.utils import encoding
|
from cloudbaseinit.utils import encoding
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
opts = [
|
|
||||||
cfg.IntOpt('retry_count', default=5,
|
|
||||||
help='Max. number of attempts for fetching metadata in '
|
|
||||||
'case of transient errors'),
|
|
||||||
cfg.FloatOpt('retry_count_interval', default=4,
|
|
||||||
help='Interval between attempts in case of transient errors, '
|
|
||||||
'expressed in seconds'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
# Both the custom service(s) and the networking plugin
|
# Both the custom service(s) and the networking plugin
|
||||||
|
@ -16,25 +16,15 @@
|
|||||||
import json
|
import json
|
||||||
import posixpath
|
import posixpath
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.utils import debiface
|
from cloudbaseinit.utils import debiface
|
||||||
from cloudbaseinit.utils import encoding
|
from cloudbaseinit.utils import encoding
|
||||||
from cloudbaseinit.utils import x509constants
|
from cloudbaseinit.utils import x509constants
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
OPENSTACK_OPTS = [
|
|
||||||
cfg.StrOpt("metadata_base_url", default="http://169.254.169.254/",
|
|
||||||
help="The base URL where the service looks for metadata",
|
|
||||||
deprecated_group="DEFAULT")
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_group(cfg.OptGroup('openstack'))
|
|
||||||
CONF.register_opts(OPENSTACK_OPTS, 'openstack')
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,26 +15,17 @@
|
|||||||
import contextlib
|
import contextlib
|
||||||
import posixpath
|
import posixpath
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
from six.moves import http_client
|
from six.moves import http_client
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.utils import encoding
|
from cloudbaseinit.utils import encoding
|
||||||
|
|
||||||
CLOUDSTACK_OPTS = [
|
|
||||||
cfg.StrOpt("metadata_base_url", default="http://10.1.1.1/",
|
|
||||||
help="The base URL where the service looks for metadata",
|
|
||||||
deprecated_name="cloudstack_metadata_ip",
|
|
||||||
deprecated_group="DEFAULT"),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_group(cfg.OptGroup("cloudstack"))
|
|
||||||
CONF.register_opts(CLOUDSTACK_OPTS, "cloudstack")
|
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
BAD_REQUEST = b"bad_request"
|
BAD_REQUEST = b"bad_request"
|
||||||
|
@ -15,64 +15,21 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
|
from cloudbaseinit import constant
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.metadata.services import baseopenstackservice
|
from cloudbaseinit.metadata.services import baseopenstackservice
|
||||||
from cloudbaseinit.metadata.services.osconfigdrive import factory
|
from cloudbaseinit.metadata.services.osconfigdrive import factory
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
# Config Drive types and possible locations.
|
|
||||||
CD_TYPES = {
|
|
||||||
"vfat", # Visible device (with partition table).
|
|
||||||
"iso", # "Raw" format containing ISO bytes.
|
|
||||||
}
|
|
||||||
CD_LOCATIONS = {
|
|
||||||
# Look into optical units devices. Only an ISO format could
|
|
||||||
# be used here (vfat ignored).
|
|
||||||
"cdrom",
|
|
||||||
# Search through physical disks for raw ISO content or vfat filesystems
|
|
||||||
# containing configuration drive's content.
|
|
||||||
"hdd",
|
|
||||||
# Search through partitions for raw ISO content or through volumes
|
|
||||||
# containing configuration drive's content.
|
|
||||||
"partition",
|
|
||||||
}
|
|
||||||
|
|
||||||
CONFIG_DRIVE_OPTS = [
|
|
||||||
cfg.BoolOpt("raw_hdd", default=True,
|
|
||||||
help="Look for an ISO config drive in raw HDDs",
|
|
||||||
deprecated_name="config_drive_raw_hhd",
|
|
||||||
deprecated_group="DEFAULT",
|
|
||||||
deprecated_for_removal=True),
|
|
||||||
cfg.BoolOpt("cdrom", default=True,
|
|
||||||
help="Look for a config drive in the attached cdrom drives",
|
|
||||||
deprecated_name="config_drive_cdrom",
|
|
||||||
deprecated_group="DEFAULT",
|
|
||||||
deprecated_for_removal=True),
|
|
||||||
cfg.BoolOpt("vfat", default=True,
|
|
||||||
help="Look for a config drive in VFAT filesystems",
|
|
||||||
deprecated_name="config_drive_vfat",
|
|
||||||
deprecated_group="DEFAULT",
|
|
||||||
deprecated_for_removal=True),
|
|
||||||
cfg.ListOpt("types", default=list(CD_TYPES),
|
|
||||||
help="Supported formats of a configuration drive",
|
|
||||||
deprecated_name="config_drive_types",
|
|
||||||
deprecated_group="DEFAULT",),
|
|
||||||
cfg.ListOpt("locations", default=list(CD_LOCATIONS),
|
|
||||||
deprecated_name="config_drive_locations",
|
|
||||||
deprecated_group="DEFAULT",
|
|
||||||
help="Supported configuration drive locations"),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_group(cfg.OptGroup("config_drive"))
|
|
||||||
CONF.register_opts(CONFIG_DRIVE_OPTS, "config_drive")
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
CD_TYPES = constant.CD_TYPES
|
||||||
|
CD_LOCATIONS = constant.CD_LOCATIONS
|
||||||
|
|
||||||
|
|
||||||
class ConfigDriveService(baseopenstackservice.BaseOpenStackService):
|
class ConfigDriveService(baseopenstackservice.BaseOpenStackService):
|
||||||
|
|
||||||
|
@ -15,29 +15,16 @@
|
|||||||
|
|
||||||
import posixpath
|
import posixpath
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
from six.moves.urllib import error
|
from six.moves.urllib import error
|
||||||
from six.moves.urllib import request
|
from six.moves.urllib import request
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.utils import network
|
from cloudbaseinit.utils import network
|
||||||
|
|
||||||
EC2_OPTS = [
|
|
||||||
cfg.StrOpt("metadata_base_url", default="http://169.254.169.254/",
|
|
||||||
help="The base URL where the service looks for metadata",
|
|
||||||
deprecated_name="ec2_metadata_base_url",
|
|
||||||
deprecated_group="DEFAULT"),
|
|
||||||
cfg.BoolOpt("add_metadata_private_ip_route", default=True,
|
|
||||||
help="Add a route for the metadata ip address to the gateway",
|
|
||||||
deprecated_name="ec2_add_metadata_private_ip_route",
|
|
||||||
deprecated_group="DEFAULT"),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_group(cfg.OptGroup("ec2"))
|
|
||||||
CONF.register_opts(EC2_OPTS, "ec2")
|
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,27 +14,16 @@
|
|||||||
|
|
||||||
import posixpath
|
import posixpath
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
from six.moves.urllib import error
|
from six.moves.urllib import error
|
||||||
from six.moves.urllib import request
|
from six.moves.urllib import request
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.metadata.services import baseopenstackservice
|
from cloudbaseinit.metadata.services import baseopenstackservice
|
||||||
from cloudbaseinit.utils import network
|
from cloudbaseinit.utils import network
|
||||||
|
|
||||||
OPENSTACK_OPTS = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.StrOpt("metadata_base_url", default="http://169.254.169.254/",
|
|
||||||
help="The base URL where the service looks for metadata",
|
|
||||||
deprecated_group="DEFAULT"),
|
|
||||||
cfg.BoolOpt("add_metadata_private_ip_route", default=True,
|
|
||||||
help="Add a route for the metadata ip address to the gateway",
|
|
||||||
deprecated_group="DEFAULT"),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(OPENSTACK_OPTS, "openstack")
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,41 +16,15 @@ import posixpath
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from oauthlib import oauth1
|
from oauthlib import oauth1
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
from six.moves.urllib import error
|
from six.moves.urllib import error
|
||||||
from six.moves.urllib import request
|
from six.moves.urllib import request
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.utils import x509constants
|
from cloudbaseinit.utils import x509constants
|
||||||
|
|
||||||
MAAS_OPTS = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.StrOpt("metadata_base_url", default=None,
|
|
||||||
help="The base URL for MaaS metadata",
|
|
||||||
deprecated_name="maas_metadata_url",
|
|
||||||
deprecated_group="DEFAULT"),
|
|
||||||
cfg.StrOpt("oauth_consumer_key", default="",
|
|
||||||
help="The MaaS OAuth consumer key",
|
|
||||||
deprecated_name="maas_oauth_consumer_key",
|
|
||||||
deprecated_group="DEFAULT"),
|
|
||||||
cfg.StrOpt("oauth_consumer_secret", default="",
|
|
||||||
help="The MaaS OAuth consumer secret",
|
|
||||||
deprecated_name="maas_oauth_consumer_secret",
|
|
||||||
deprecated_group="DEFAULT"),
|
|
||||||
cfg.StrOpt("oauth_token_key", default="",
|
|
||||||
help="The MaaS OAuth token key",
|
|
||||||
deprecated_name="maas_oauth_token_key",
|
|
||||||
deprecated_group="DEFAULT"),
|
|
||||||
cfg.StrOpt("oauth_token_secret", default="",
|
|
||||||
help="The MaaS OAuth token secret",
|
|
||||||
deprecated_name="maas_oauth_token_secret",
|
|
||||||
deprecated_group="DEFAULT"),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_group(cfg.OptGroup("maas"))
|
|
||||||
CONF.register_opts(MAAS_OPTS, "maas")
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,25 +20,16 @@ import struct
|
|||||||
import tempfile
|
import tempfile
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
from cloudbaseinit.metadata.services.osconfigdrive import base
|
from cloudbaseinit.metadata.services.osconfigdrive import base
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.utils.windows import disk
|
from cloudbaseinit.utils.windows import disk
|
||||||
from cloudbaseinit.utils.windows import vfat
|
from cloudbaseinit.utils.windows import vfat
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
opts = [
|
|
||||||
cfg.StrOpt('bsdtar_path', default='bsdtar.exe',
|
|
||||||
help='Path to "bsdtar", used to extract ISO ConfigDrive '
|
|
||||||
'files'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
CONFIG_DRIVE_LABEL = 'config-2'
|
CONFIG_DRIVE_LABEL = 'config-2'
|
||||||
|
@ -14,26 +14,15 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.plugins.common import constants
|
from cloudbaseinit.plugins.common import constants
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
opts = [
|
|
||||||
cfg.StrOpt('username', default='Admin', help='User to be added to the '
|
|
||||||
'system or updated if already existing'),
|
|
||||||
cfg.ListOpt('groups', default=['Administrators'], help='List of local '
|
|
||||||
'groups to which the user specified in \'username\' will '
|
|
||||||
'be added'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,20 +14,12 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from oslo_config import cfg
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
|
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.plugins.common import execcmd
|
from cloudbaseinit.plugins.common import execcmd
|
||||||
from cloudbaseinit.plugins.common import fileexecutils
|
from cloudbaseinit.plugins.common import fileexecutils
|
||||||
|
|
||||||
opts = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.StrOpt('local_scripts_path', default=None,
|
|
||||||
help='Path location containing scripts to be executed when '
|
|
||||||
'the plugin runs'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
|
|
||||||
class LocalScriptsPlugin(base.BasePlugin):
|
class LocalScriptsPlugin(base.BasePlugin):
|
||||||
|
@ -14,23 +14,14 @@
|
|||||||
|
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.utils import dhcp
|
from cloudbaseinit.utils import dhcp
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
opts = [
|
|
||||||
cfg.BoolOpt('mtu_use_dhcp_config', default=True,
|
|
||||||
help='Configures the network interfaces MTU based on the '
|
|
||||||
'values provided via DHCP'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,22 +14,14 @@
|
|||||||
|
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.utils import dhcp
|
from cloudbaseinit.utils import dhcp
|
||||||
|
|
||||||
opts = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.BoolOpt('ntp_use_dhcp_config', default=False,
|
|
||||||
help='Configures NTP client time synchronization using '
|
|
||||||
'the NTP servers provided via DHCP'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,44 +14,17 @@
|
|||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
|
from cloudbaseinit import constant
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.plugins.common import constants
|
from cloudbaseinit.plugins.common import constants as plugin_constant
|
||||||
from cloudbaseinit.utils import crypt
|
from cloudbaseinit.utils import crypt
|
||||||
|
|
||||||
|
|
||||||
CLEAR_TEXT_INJECTED_ONLY = 'clear_text_injected_only'
|
CONF = cloudbaseinit_conf.CONF
|
||||||
ALWAYS_CHANGE = 'always'
|
|
||||||
NEVER_CHANGE = 'no'
|
|
||||||
LOGON_PASSWORD_CHANGE_OPTIONS = [
|
|
||||||
CLEAR_TEXT_INJECTED_ONLY,
|
|
||||||
NEVER_CHANGE,
|
|
||||||
ALWAYS_CHANGE,
|
|
||||||
]
|
|
||||||
opts = [
|
|
||||||
cfg.BoolOpt('inject_user_password', default=True, help='Set the password '
|
|
||||||
'provided in the configuration. If False or no password is '
|
|
||||||
'provided, a random one will be set'),
|
|
||||||
cfg.StrOpt('first_logon_behaviour',
|
|
||||||
default=CLEAR_TEXT_INJECTED_ONLY,
|
|
||||||
choices=LOGON_PASSWORD_CHANGE_OPTIONS,
|
|
||||||
help='Control the behaviour of what happens at '
|
|
||||||
'next logon. If this option is set to `always`, '
|
|
||||||
'then the user will be forced to change the password '
|
|
||||||
'at next logon. If it is set to '
|
|
||||||
'`clear_text_injected_only`, '
|
|
||||||
'then the user will have to change the password only if '
|
|
||||||
'the password is a clear text password, coming from the '
|
|
||||||
'metadata. The last option is `no`, when the user is '
|
|
||||||
'never forced to change the password.'),
|
|
||||||
]
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
CONF.import_opt('username', 'cloudbaseinit.plugins.common.createuser')
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -80,7 +53,7 @@ class SetUserPasswordPlugin(base.BasePlugin):
|
|||||||
LOG.warn('Using admin_pass metadata user password. Consider '
|
LOG.warn('Using admin_pass metadata user password. Consider '
|
||||||
'changing it as soon as possible')
|
'changing it as soon as possible')
|
||||||
else:
|
else:
|
||||||
password = shared_data.get(constants.SHARED_DATA_PASSWORD)
|
password = shared_data.get(plugin_constant.SHARED_DATA_PASSWORD)
|
||||||
|
|
||||||
return password, injected
|
return password, injected
|
||||||
|
|
||||||
@ -131,11 +104,12 @@ class SetUserPasswordPlugin(base.BasePlugin):
|
|||||||
If the option is activated, force the user to change the
|
If the option is activated, force the user to change the
|
||||||
password at next logon.
|
password at next logon.
|
||||||
"""
|
"""
|
||||||
if CONF.first_logon_behaviour == NEVER_CHANGE:
|
if CONF.first_logon_behaviour == constant.NEVER_CHANGE:
|
||||||
return
|
return
|
||||||
|
|
||||||
clear_text = CONF.first_logon_behaviour == CLEAR_TEXT_INJECTED_ONLY
|
clear_text = (CONF.first_logon_behaviour ==
|
||||||
always = CONF.first_logon_behaviour == ALWAYS_CHANGE
|
constant.CLEAR_TEXT_INJECTED_ONLY)
|
||||||
|
always = CONF.first_logon_behaviour == constant.ALWAYS_CHANGE
|
||||||
if always or (clear_text and password_injected):
|
if always or (clear_text and password_injected):
|
||||||
osutils = osutils_factory.get_os_utils()
|
osutils = osutils_factory.get_os_utils()
|
||||||
osutils.change_password_next_logon(username)
|
osutils.change_password_next_logon(username)
|
||||||
@ -143,7 +117,7 @@ class SetUserPasswordPlugin(base.BasePlugin):
|
|||||||
def execute(self, service, shared_data):
|
def execute(self, service, shared_data):
|
||||||
# TODO(alexpilotti): The username selection logic must be set in the
|
# TODO(alexpilotti): The username selection logic must be set in the
|
||||||
# CreateUserPlugin instead if using CONF.username
|
# CreateUserPlugin instead if using CONF.username
|
||||||
user_name = shared_data.get(constants.SHARED_DATA_USERNAME,
|
user_name = shared_data.get(plugin_constant.SHARED_DATA_USERNAME,
|
||||||
CONF.username)
|
CONF.username)
|
||||||
|
|
||||||
osutils = osutils_factory.get_os_utils()
|
osutils = osutils_factory.get_os_utils()
|
||||||
@ -154,7 +128,7 @@ class SetUserPasswordPlugin(base.BasePlugin):
|
|||||||
LOG.info('Password succesfully updated for user %s' %
|
LOG.info('Password succesfully updated for user %s' %
|
||||||
user_name)
|
user_name)
|
||||||
# TODO(alexpilotti): encrypt with DPAPI
|
# TODO(alexpilotti): encrypt with DPAPI
|
||||||
shared_data[constants.SHARED_DATA_PASSWORD] = password
|
shared_data[plugin_constant.SHARED_DATA_PASSWORD] = password
|
||||||
|
|
||||||
if not service.can_post_password:
|
if not service.can_post_password:
|
||||||
LOG.info('Cannot set the password in the metadata as it '
|
LOG.info('Cannot set the password in the metadata as it '
|
||||||
|
@ -14,16 +14,15 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
CONF.import_opt('username', 'cloudbaseinit.plugins.common.createuser')
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
# 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 oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.plugins.common import execcmd
|
from cloudbaseinit.plugins.common import execcmd
|
||||||
from cloudbaseinit.plugins.common.userdataplugins import base
|
from cloudbaseinit.plugins.common.userdataplugins import base
|
||||||
from cloudbaseinit.plugins.common.userdataplugins.cloudconfigplugins import (
|
from cloudbaseinit.plugins.common.userdataplugins.cloudconfigplugins import (
|
||||||
@ -24,19 +24,8 @@ from cloudbaseinit.plugins.common.userdataplugins.cloudconfigplugins import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
OPTS = [
|
|
||||||
cfg.ListOpt(
|
|
||||||
'cloud_config_plugins',
|
|
||||||
default=[],
|
|
||||||
help=(
|
|
||||||
'List which contains the name of the cloud config plugins '
|
|
||||||
'ordered by priority.'
|
|
||||||
),
|
|
||||||
)
|
|
||||||
]
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(OPTS)
|
|
||||||
DEFAULT_ORDER_VALUE = 999
|
DEFAULT_ORDER_VALUE = 999
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,32 +12,10 @@
|
|||||||
# 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 oslo_config import cfg
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
|
|
||||||
from cloudbaseinit.utils import classloader
|
from cloudbaseinit.utils import classloader
|
||||||
|
|
||||||
opts = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.ListOpt(
|
|
||||||
'user_data_plugins',
|
|
||||||
default=[
|
|
||||||
'cloudbaseinit.plugins.common.userdataplugins.parthandler.'
|
|
||||||
'PartHandlerPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.userdataplugins.cloudconfig.'
|
|
||||||
'CloudConfigPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.userdataplugins.cloudboothook.'
|
|
||||||
'CloudBootHookPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.userdataplugins.shellscript.'
|
|
||||||
'ShellScriptPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.userdataplugins.multipartmixed.'
|
|
||||||
'MultipartMixedPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.userdataplugins.heat.'
|
|
||||||
'HeatPlugin',
|
|
||||||
],
|
|
||||||
help='List of enabled userdata content plugins'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
|
|
||||||
def load_plugins():
|
def load_plugins():
|
||||||
|
@ -15,21 +15,14 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.plugins.common.userdataplugins import base
|
from cloudbaseinit.plugins.common.userdataplugins import base
|
||||||
from cloudbaseinit.plugins.common import userdatautils
|
from cloudbaseinit.plugins.common import userdatautils
|
||||||
from cloudbaseinit.utils import encoding
|
from cloudbaseinit.utils import encoding
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
opts = [
|
|
||||||
cfg.StrOpt('heat_config_dir', default='C:\\cfn', help='The directory '
|
|
||||||
'where the Heat configuration files must be saved'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
|
|
||||||
class HeatPlugin(base.BaseUserDataPlugin):
|
class HeatPlugin(base.BaseUserDataPlugin):
|
||||||
|
@ -12,40 +12,13 @@
|
|||||||
# 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 oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.utils import classloader
|
from cloudbaseinit.utils import classloader
|
||||||
|
|
||||||
|
|
||||||
opts = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.ListOpt(
|
|
||||||
'plugins',
|
|
||||||
default=[
|
|
||||||
'cloudbaseinit.plugins.common.mtu.MTUPlugin',
|
|
||||||
'cloudbaseinit.plugins.windows.ntpclient.NTPClientPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin',
|
|
||||||
'cloudbaseinit.plugins.windows.createuser.CreateUserPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.networkconfig.NetworkConfigPlugin',
|
|
||||||
'cloudbaseinit.plugins.windows.licensing.WindowsLicensingPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.sshpublickeys.'
|
|
||||||
'SetUserSSHPublicKeysPlugin',
|
|
||||||
'cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.userdata.UserDataPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.setuserpassword.'
|
|
||||||
'SetUserPasswordPlugin',
|
|
||||||
'cloudbaseinit.plugins.windows.winrmlistener.'
|
|
||||||
'ConfigWinRMListenerPlugin',
|
|
||||||
'cloudbaseinit.plugins.windows.winrmcertificateauth.'
|
|
||||||
'ConfigWinRMCertificateAuthPlugin',
|
|
||||||
'cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin',
|
|
||||||
],
|
|
||||||
help='List of enabled plugin classes, '
|
|
||||||
'to executed in the provided order'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
# Some plugins were moved to plugins.common, in order to
|
# Some plugins were moved to plugins.common, in order to
|
||||||
|
@ -12,23 +12,11 @@
|
|||||||
# 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 oslo_config import cfg
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
|
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.utils.windows.storage import factory as storage_factory
|
from cloudbaseinit.utils.windows.storage import factory as storage_factory
|
||||||
|
|
||||||
opts = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.ListOpt('volumes_to_extend',
|
|
||||||
default=None,
|
|
||||||
help='List of volumes that need to be extended '
|
|
||||||
'if contiguous space is available on the disk. By default '
|
|
||||||
'all the available volumes can be extended. Volumes must '
|
|
||||||
'be specified using a comma separated list of volume indexes, '
|
|
||||||
'e.g.: "1,2"'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
|
|
||||||
class ExtendVolumesPlugin(base.BasePlugin):
|
class ExtendVolumesPlugin(base.BasePlugin):
|
||||||
|
@ -14,22 +14,15 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
|
|
||||||
|
|
||||||
opts = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.BoolOpt('activate_windows', default=False,
|
|
||||||
help='Activates Windows automatically'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
# 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 oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
@ -24,8 +24,7 @@ from cloudbaseinit.utils.windows import winrmconfig
|
|||||||
from cloudbaseinit.utils.windows import x509
|
from cloudbaseinit.utils.windows import x509
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
CONF.import_opt('username', 'cloudbaseinit.plugins.common.createuser')
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
# 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 oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.osutils import factory as osutils_factory
|
from cloudbaseinit.osutils import factory as osutils_factory
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.utils.windows import security
|
from cloudbaseinit.utils.windows import security
|
||||||
@ -22,15 +22,7 @@ from cloudbaseinit.utils.windows import winrmconfig
|
|||||||
from cloudbaseinit.utils.windows import x509
|
from cloudbaseinit.utils.windows import x509
|
||||||
|
|
||||||
|
|
||||||
opts = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.BoolOpt('winrm_enable_basic_auth', default=True,
|
|
||||||
help='Enables basic authentication for the WinRM '
|
|
||||||
'HTTPS listener'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,13 +22,13 @@ if struct.calcsize("P") == 8 and sys.platform == 'win32':
|
|||||||
sys.coinit_flags = pythoncom.COINIT_MULTITHREADED
|
sys.coinit_flags = pythoncom.COINIT_MULTITHREADED
|
||||||
pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)
|
pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import init
|
from cloudbaseinit import init
|
||||||
from cloudbaseinit.utils import log as logging
|
from cloudbaseinit.utils import log as logging
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -22,13 +22,13 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
OPEN = mock.mock_open()
|
OPEN = mock.mock_open()
|
||||||
|
|
||||||
|
@ -21,15 +21,15 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.metadata.services import baseopenstackservice
|
from cloudbaseinit.metadata.services import baseopenstackservice
|
||||||
from cloudbaseinit.tests.metadata import fake_json_response
|
from cloudbaseinit.tests.metadata import fake_json_response
|
||||||
from cloudbaseinit.utils import x509constants
|
from cloudbaseinit.utils import x509constants
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
MODPATH = "cloudbaseinit.metadata.services.baseopenstackservice"
|
MODPATH = "cloudbaseinit.metadata.services.baseopenstackservice"
|
||||||
|
|
||||||
|
@ -20,14 +20,14 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.metadata.services import cloudstack
|
from cloudbaseinit.metadata.services import cloudstack
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class CloudStackTest(unittest.TestCase):
|
class CloudStackTest(unittest.TestCase):
|
||||||
|
@ -19,14 +19,14 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
from six.moves.urllib import error
|
from six.moves.urllib import error
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.metadata.services import ec2service
|
from cloudbaseinit.metadata.services import ec2service
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class EC2ServiceTest(unittest.TestCase):
|
class EC2ServiceTest(unittest.TestCase):
|
||||||
|
@ -19,13 +19,13 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
from six.moves.urllib import error
|
from six.moves.urllib import error
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.metadata.services import httpservice
|
from cloudbaseinit.metadata.services import httpservice
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class HttpServiceTest(unittest.TestCase):
|
class HttpServiceTest(unittest.TestCase):
|
||||||
|
@ -20,16 +20,16 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
from six.moves.urllib import error
|
from six.moves.urllib import error
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.metadata.services import base
|
from cloudbaseinit.metadata.services import base
|
||||||
from cloudbaseinit.metadata.services import maasservice
|
from cloudbaseinit.metadata.services import maasservice
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
from cloudbaseinit.utils import x509constants
|
from cloudbaseinit.utils import x509constants
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class MaaSHttpServiceTest(unittest.TestCase):
|
class MaaSHttpServiceTest(unittest.TestCase):
|
||||||
|
@ -22,14 +22,14 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
from cloudbaseinit.tests import fake
|
from cloudbaseinit.tests import fake
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class WMIError(Exception):
|
class WMIError(Exception):
|
||||||
|
@ -18,13 +18,13 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.plugins.common import createuser
|
from cloudbaseinit.plugins.common import createuser
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class CreateUserPlugin(createuser.BaseCreateUserPlugin):
|
class CreateUserPlugin(createuser.BaseCreateUserPlugin):
|
||||||
|
@ -18,14 +18,16 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
|
from cloudbaseinit import constant
|
||||||
from cloudbaseinit.plugins.common import constants
|
from cloudbaseinit.plugins.common import constants
|
||||||
from cloudbaseinit.plugins.common import setuserpassword
|
from cloudbaseinit.plugins.common import setuserpassword
|
||||||
from cloudbaseinit.tests.metadata import fake_json_response
|
from cloudbaseinit.tests.metadata import fake_json_response
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class SetUserPasswordPluginTests(unittest.TestCase):
|
class SetUserPasswordPluginTests(unittest.TestCase):
|
||||||
@ -281,7 +283,7 @@ class SetUserPasswordPluginTests(unittest.TestCase):
|
|||||||
|
|
||||||
@mock.patch.object(setuserpassword.osutils_factory, 'get_os_utils')
|
@mock.patch.object(setuserpassword.osutils_factory, 'get_os_utils')
|
||||||
@testutils.ConfPatcher('first_logon_behaviour',
|
@testutils.ConfPatcher('first_logon_behaviour',
|
||||||
setuserpassword.NEVER_CHANGE)
|
constant.NEVER_CHANGE)
|
||||||
def test_logon_behaviour_never_change(self, mock_get_os_utils):
|
def test_logon_behaviour_never_change(self, mock_get_os_utils):
|
||||||
self._setpassword_plugin._change_logon_behaviour(
|
self._setpassword_plugin._change_logon_behaviour(
|
||||||
mock.sentinel.username)
|
mock.sentinel.username)
|
||||||
@ -289,7 +291,7 @@ class SetUserPasswordPluginTests(unittest.TestCase):
|
|||||||
self.assertFalse(mock_get_os_utils.called)
|
self.assertFalse(mock_get_os_utils.called)
|
||||||
|
|
||||||
@testutils.ConfPatcher('first_logon_behaviour',
|
@testutils.ConfPatcher('first_logon_behaviour',
|
||||||
setuserpassword.ALWAYS_CHANGE)
|
constant.ALWAYS_CHANGE)
|
||||||
@mock.patch.object(setuserpassword, 'osutils_factory')
|
@mock.patch.object(setuserpassword, 'osutils_factory')
|
||||||
def test_logon_behaviour_always(self, mock_factory):
|
def test_logon_behaviour_always(self, mock_factory):
|
||||||
self._setpassword_plugin._change_logon_behaviour(
|
self._setpassword_plugin._change_logon_behaviour(
|
||||||
@ -302,7 +304,7 @@ class SetUserPasswordPluginTests(unittest.TestCase):
|
|||||||
mock.sentinel.username)
|
mock.sentinel.username)
|
||||||
|
|
||||||
@testutils.ConfPatcher('first_logon_behaviour',
|
@testutils.ConfPatcher('first_logon_behaviour',
|
||||||
setuserpassword.CLEAR_TEXT_INJECTED_ONLY)
|
constant.CLEAR_TEXT_INJECTED_ONLY)
|
||||||
@mock.patch.object(setuserpassword, 'osutils_factory')
|
@mock.patch.object(setuserpassword, 'osutils_factory')
|
||||||
def test_change_logon_behaviour_clear_text_password_not_injected(
|
def test_change_logon_behaviour_clear_text_password_not_injected(
|
||||||
self, mock_factory):
|
self, mock_factory):
|
||||||
@ -314,7 +316,7 @@ class SetUserPasswordPluginTests(unittest.TestCase):
|
|||||||
self.assertFalse(mock_get_os_utils.called)
|
self.assertFalse(mock_get_os_utils.called)
|
||||||
|
|
||||||
@testutils.ConfPatcher('first_logon_behaviour',
|
@testutils.ConfPatcher('first_logon_behaviour',
|
||||||
setuserpassword.CLEAR_TEXT_INJECTED_ONLY)
|
constant.CLEAR_TEXT_INJECTED_ONLY)
|
||||||
@mock.patch.object(setuserpassword, 'osutils_factory')
|
@mock.patch.object(setuserpassword, 'osutils_factory')
|
||||||
def test_logon_behaviour_clear_text_password_injected(
|
def test_logon_behaviour_clear_text_password_injected(
|
||||||
self, mock_factory):
|
self, mock_factory):
|
||||||
|
@ -22,8 +22,8 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
from cloudbaseinit.plugins.common.userdataplugins import cloudconfig
|
from cloudbaseinit.plugins.common.userdataplugins import cloudconfig
|
||||||
from cloudbaseinit.plugins.common.userdataplugins.cloudconfigplugins import (
|
from cloudbaseinit.plugins.common.userdataplugins.cloudconfigplugins import (
|
||||||
@ -31,7 +31,7 @@ from cloudbaseinit.plugins.common.userdataplugins.cloudconfigplugins import (
|
|||||||
)
|
)
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
def _create_tempfile():
|
def _create_tempfile():
|
||||||
|
@ -19,12 +19,11 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from oslo_config import cfg
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
|
|
||||||
from cloudbaseinit.plugins.common.userdataplugins import cloudconfig
|
from cloudbaseinit.plugins.common.userdataplugins import cloudconfig
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class CloudConfigPluginTests(unittest.TestCase):
|
class CloudConfigPluginTests(unittest.TestCase):
|
||||||
|
@ -19,11 +19,11 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.plugins.common.userdataplugins import heat
|
from cloudbaseinit.plugins.common.userdataplugins import heat
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class HeatUserDataHandlerTests(unittest.TestCase):
|
class HeatUserDataHandlerTests(unittest.TestCase):
|
||||||
|
@ -19,13 +19,13 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.plugins import factory
|
from cloudbaseinit.plugins import factory
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
STAGE = {
|
STAGE = {
|
||||||
base.PLUGIN_STAGE_PRE_NETWORKING: [
|
base.PLUGIN_STAGE_PRE_NETWORKING: [
|
||||||
|
@ -18,12 +18,12 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
from cloudbaseinit.plugins.windows import ntpclient
|
from cloudbaseinit.plugins.windows import ntpclient
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class NTPClientPluginTests(unittest.TestCase):
|
class NTPClientPluginTests(unittest.TestCase):
|
||||||
|
@ -19,12 +19,12 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class ConfigWinRMListenerPluginTests(unittest.TestCase):
|
class ConfigWinRMListenerPluginTests(unittest.TestCase):
|
||||||
|
@ -19,13 +19,13 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import init
|
from cloudbaseinit import init
|
||||||
from cloudbaseinit.plugins.common import base
|
from cloudbaseinit.plugins.common import base
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class TestInitManager(unittest.TestCase):
|
class TestInitManager(unittest.TestCase):
|
||||||
|
@ -25,13 +25,13 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
|
@ -19,12 +19,11 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from oslo_config import cfg
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
|
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
from cloudbaseinit.utils import hostname
|
from cloudbaseinit.utils import hostname
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class HostnameUtilsTest(unittest.TestCase):
|
class HostnameUtilsTest(unittest.TestCase):
|
||||||
|
@ -19,10 +19,11 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
CONF = cfg.CONF
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class SerialPortHandlerTests(unittest.TestCase):
|
class SerialPortHandlerTests(unittest.TestCase):
|
||||||
|
@ -18,13 +18,13 @@ try:
|
|||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit.tests import testutils
|
from cloudbaseinit.tests import testutils
|
||||||
from cloudbaseinit.utils import network
|
from cloudbaseinit.utils import network
|
||||||
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cloudbaseinit_conf.CONF
|
||||||
|
|
||||||
|
|
||||||
class NetworkUtilsTest(unittest.TestCase):
|
class NetworkUtilsTest(unittest.TestCase):
|
||||||
|
@ -15,18 +15,11 @@
|
|||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
opts = [
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
cfg.BoolOpt('netbios_host_name_compatibility', default=True,
|
|
||||||
help='Truncates the hostname to 15 characters for Netbios '
|
|
||||||
'compatibility'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
|
|
||||||
|
CONF = cloudbaseinit_conf.CONF
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
|
|
||||||
NETBIOS_HOST_NAME_MAX_LEN = 15
|
NETBIOS_HOST_NAME_MAX_LEN = 15
|
||||||
|
@ -16,21 +16,12 @@ import logging
|
|||||||
import serial
|
import serial
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import formatters
|
from oslo_log import formatters
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
|
|
||||||
opts = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.StrOpt('logging_serial_port_settings', default=None,
|
|
||||||
help='Serial port logging settings. Format: '
|
|
||||||
'"port,baudrate,parity,bytesize", e.g.: "COM1,115200,N,8". '
|
|
||||||
'Set to None (default) to disable.'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
log.register_options(CONF)
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,20 +15,13 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as oslo_logging
|
from oslo_log import log as oslo_logging
|
||||||
|
|
||||||
|
from cloudbaseinit import conf as cloudbaseinit_conf
|
||||||
from cloudbaseinit import exception
|
from cloudbaseinit import exception
|
||||||
|
|
||||||
|
|
||||||
opts = [
|
CONF = cloudbaseinit_conf.CONF
|
||||||
cfg.StrOpt('mtools_path', default=None,
|
|
||||||
help='Path to "mtools" program suite, used for interacting '
|
|
||||||
'with VFAT filesystems'),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts)
|
|
||||||
CONFIG_DRIVE_LABEL = 'config-2'
|
CONFIG_DRIVE_LABEL = 'config-2'
|
||||||
LOG = oslo_logging.getLogger(__name__)
|
LOG = oslo_logging.getLogger(__name__)
|
||||||
VOLUME_LABEL_REGEX = re.compile("Volume label is (.*?)$")
|
VOLUME_LABEL_REGEX = re.compile("Volume label is (.*?)$")
|
||||||
|
4
etc/cloudbase-init/README.md
Normal file
4
etc/cloudbase-init/README.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
To generate the sample cloudbase-init.conf file, run the following command from the top
|
||||||
|
level of the cloudbase-init directory:
|
||||||
|
|
||||||
|
oslo-config-generator --config-file etc/cloudbase-init/cloudbase-init-config-generator.conf
|
4
etc/cloudbase-init/cloudbase-init-config-generator.conf
Normal file
4
etc/cloudbase-init/cloudbase-init-config-generator.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
output_file = etc/cloudbase-init/cloudbase-init.conf.sample
|
||||||
|
wrap_width = 80
|
||||||
|
namespace = cloudbaseinit.conf
|
Loading…
x
Reference in New Issue
Block a user