Code Monkey home page Code Monkey logo

cloudbase-init's Introduction

cloudbase-init's People

Contributors

ader1990 avatar ajaeger avatar alexcoman avatar alexpilotti avatar avladu avatar chenhanxiao avatar claudiubelu avatar cmin764 avatar fungi avatar gokrokvertskhov avatar jdillet avatar kajinamit avatar klindgren-godaddy avatar luqmana avatar mgagne avatar mrcocoacat avatar onovy avatar pcmanticore avatar petrutlucian94 avatar pubyun avatar r0ckpine avatar rgl avatar s7oneyuk avatar stmcginnis avatar superpeng000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudbase-init's Issues

How can I skip updating user password?

Hi guys,

I'm using ConfigDrive service to provide meta source, and for some actions, the user may not change their password. And when I tried to emit meta.admin_pass field in file meta_data.json, a random user password was set, thus the user(I) could not logon then after. So how can I skip updating user password for sometimes? Or is it a mandatory option for every uuid instance?

And then I modified method _set_password in file setuserpassword.py:
from(docs emitted):

    def _set_password(self, service, osutils, user_name, shared_data):
        if service.can_update_password and not service.is_password_changed():
            LOG.info('Updating password is not required.')
            return None

        password, injected = self._get_password(service, shared_data)
        if not password:
            LOG.debug('Generating a random user password')
            password = osutils.generate_random_password(
                CONF.user_password_length)

        osutils.set_user_password(user_name, password)
        self._change_logon_behaviour(user_name, password_injected=injected)
        return password

to(docs emitted):

    def _set_password(self, service, osutils, user_name, shared_data):
        if service.can_update_password and not service.is_password_changed():
            LOG.info('Updating password is not required.')
            return None

        password, injected = self._get_password(service, shared_data)
        if password:
            osutils.set_user_password(user_name, password)
            self._change_logon_behaviour(user_name, password_injected=injected)
        else:
            LOG.debug('no password set, skipping setting password...')
        return password

Still with no luck. Are there anywhere else changing user password? Or is it possible to skip that operation?

Please help me! Thanks~

Version using: 1.1.1

Network plugin does not set DNS server when using Proxmox

When using Proxmox the config that is generated for cloud-init has the DNS server key as "dns_nameserver" but the network plugin expects it to be "dns-nameserver".

I don't know cloudinit like, at all really, so I don't know if the standard allows both or what. I know the cloudinit config works for our Ubuntu images which makes me lean towards the standard, or at least the normal implementation of it, works with either.

I believe this is the responsible regex causing the issue: https://github.com/cloudbase/cloudbase-init/blob/master/cloudbaseinit/utils/debiface.py#L56

Unexpected COM Error in NetworkPlugin

cloudbase-init.log:

2020-06-09 13:45:51.710 1456 INFO cloudbaseinit.init [-] Executing plugin 'NetworkConfigPlugin'
2020-06-09 13:45:51.710 1456 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.osutils.windows.WindowsUtils' load_class C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2020-06-09 13:45:51.710 1456 INFO cloudbaseinit.plugins.common.networkconfig [-] Renaming network adapter "Ethernet 2" to "vEthernet"
2020-06-09 13:45:52.757 1456 DEBUG cloudbaseinit.plugins.common.networkconfig [-] Enable network adapter "vEthernet": True _process_link_common C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py:187
2020-06-09 13:45:53.210 1456 INFO cloudbaseinit.plugins.common.networkconfig [-] Setting static IP configuration on network adapter "vEthernet". IP: x.x.x.x, prefix length: 26, gateway: x.x.x.x, dns: ['1.1.1.1', '8.8.8.8']
2020-06-09 13:45:53.742 1456 DEBUG cloudbaseinit.osutils.windows [-] Removing existing IP address "169.254.191.95" from adapter "vEthernet" _set_static_network_config C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\osutils\windows.py:980
2020-06-09 13:45:53.945 1456 DEBUG cloudbaseinit.osutils.windows [-] Removing existing route "255.255.255.255/32" from adapter "vEthernet" _set_static_network_config C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\osutils\windows.py:989
2020-06-09 13:45:53.992 1456 DEBUG cloudbaseinit.osutils.windows [-] Removing existing route "224.0.0.0/4" from adapter "vEthernet" _set_static_network_config C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\osutils\windows.py:989
2020-06-09 13:45:54.054 1456 ERROR cloudbaseinit.init [-] plugin 'NetworkConfigPlugin' failed with error '<x_wmi: Unexpected COM Error (-2147352567, 'Exception occurred.', (0, 'SWbemObjectEx', 'Invalid parameter ', None, 0, -2147217400), None)>': wmi.x_wmi: <x_wmi: Unexpected COM Error (-2147352567, 'Exception occurred.', (0, 'SWbemObjectEx', 'Invalid parameter ', None, 0, -2147217400), None)>
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init [-] <x_wmi: Unexpected COM Error (-2147352567, 'Exception occurred.', (0, 'SWbemObjectEx', 'Invalid parameter ', None, 0, -2147217400), None)>: wmi.x_wmi: <x_wmi: Unexpected COM Error (-2147352567, 'Exception occurred.', (0, 'SWbemObjectEx', 'Invalid parameter ', None, 0, -2147217400), None)>
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init Traceback (most recent call last):
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\wmi.py", line 603, in __getattr__
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     return getattr(self.ole_object, attribute)
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\win32com\client\dynamic.py", line 516, in __getattr__
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     ret = self._oleobj_.Invoke(retEntry.dispid,0,invoke_type,1)
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'SWbemObjectEx', 'Invalid parameter ', None, 0, -2147217400), None)
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init 
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init During handling of the above exception, another exception occurred:
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init 
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init Traceback (most recent call last):
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\init.py", line 67, in _exec_plugin
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     shared_data)
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 307, in execute
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     return self._process_network_details_v2(network_details)
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 300, in _process_network_details_v2
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     osutils, network_details)
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 286, in _process_networks
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     net.link, ip_address, prefix_len, gateway, nameservers)
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\osutils\windows.py", line 1005, in set_static_network_config
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     name, address, prefix_len, gateway)
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\cloudbaseinit\osutils\windows.py", line 992, in _set_static_network_config
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     conn.MSFT_NetIPAddress.create(
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\wmi.py", line 841, in __getattr__
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     return _wmi_object.__getattr__(self, attribute)
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\wmi.py", line 605, in __getattr__
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     handle_com_error()
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init   File "C:\Program Files\CloudBase\Python\lib\site-packages\wmi.py", line 258, in handle_com_error
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init     raise klass(com_error=err)
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init wmi.x_wmi: <x_wmi: Unexpected COM Error (-2147352567, 'Exception occurred.', (0, 'SWbemObjectEx', 'Invalid parameter ', None, 0, -2147217400), None)>
2020-06-09 13:45:54.101 1456 ERROR cloudbaseinit.init

Interfaces renamed, but addresses cannot be assigned. Service WM is runned, after fer hours i try manual run service cloud-init, and receive same exceptions in log.

This log given from fresh install Windows 2012R2 (EN and RU editions), downloaded from VLSC Portal.

Affected version: 1.1.2.dev4

ExtendVolumesPlugin fails to extend volumes with small number of bytes

When ExtendVolumesPlugin tries to extend a volume with a small number of bytes, it fails with the following error:

2020-01-22 05:39:25.302 2716 INFO cloudbaseinit.init [-] Executing plugin 'ExtendVolumesPlugin'
2020-01-22 05:39:25.302 2716 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.osutils.windows.WindowsUtils' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2020-01-22 05:39:25.318 2716 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.utils.windows.storage.vds_storage_manager.VDSStorageManager' load_class c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2020-01-22 05:39:25.365 2716 INFO comtypes.client._code_cache [-] Imported existing <module 'comtypes.gen' from 'c:\\program files\\cloudbase solutions\\cloudbase-init\\python\\lib\\site-packages\\comtypes\\gen\\__init__.py'>
2020-01-22 05:39:25.365 2716 INFO comtypes.client._code_cache [-] Using writeable comtypes cache directory: 'c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\comtypes\gen'
2020-01-22 05:39:25.474 2716 INFO cloudbaseinit.utils.windows.storage.vds_storage_manager [-] Extending volume "\\?\GLOBALROOT\Device\HarddiskVolume4" with 1031680 bytes
2020-01-22 05:39:25.490 2716 ERROR cloudbaseinit.init [-] plugin 'ExtendVolumesPlugin' failed with error '(-2147212237, None, (None, None, None, 0, None))': _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None))
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init [-] (-2147212237, None, (None, None, None, 0, None)): _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None))
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init Traceback (most recent call last):
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\init.py", line 67, in _exec_plugin
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init     shared_data)
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\windows\extendvolumes.py", line 30, in execute
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init     storage_manager.extend_volumes(volumes_indexes)
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 147, in extend_volumes
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init     self._extend_volumes(pack, volume_indexes)
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 63, in _extend_volumes
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init     self._extend_volume(pack, volume, volume_prop)
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 94, in _extend_volume
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init     extend_job = volume.Extend(input_disks_ar, len(input_disks))
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None))
2020-01-22 05:39:25.505 2716 ERROR cloudbaseinit.init 

Environment: ESXi / VMware, Windows 2019 standard.

libcrypto or libeay32 cannot be loaded on Python 3.8 x86

When testing cloudbase-init using GitHub actions, there is a problem to find / load the necessary libraries for password encryption. This happens on Python 3.8 x86 environment.

Potential fix: use cryptography Python module instead of the flaky openssl library loading on Windows.

Error log:

2020-02-03T15:53:57.4616886Z 2020-02-03 15:53:57.451 1508 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin' load_class C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\utils\classloader.py:27�[00m
2020-02-03T15:53:57.5144330Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell [-] Could not find module 'libcrypto'. Try using the full path with constructor syntax.: FileNotFoundError: Could not find module 'libcrypto'. Try using the full path with constructor syntax.
2020-02-03T15:53:57.5146619Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell Traceback (most recent call last):
2020-02-03T15:53:57.5185814Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\utils\crypt.py", line 32, in <module>
2020-02-03T15:53:57.5186173Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     openssl = ctypes.cdll.libeay32
2020-02-03T15:53:57.5186519Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\ctypes\__init__.py", line 443, in __getattr__
2020-02-03T15:53:57.5186783Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     dll = self._dlltype(name)
2020-02-03T15:53:57.5187379Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\ctypes\__init__.py", line 373, in __init__
2020-02-03T15:53:57.5187632Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     self._handle = _dlopen(self._name, mode)
2020-02-03T15:53:57.5187892Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell FileNotFoundError: Could not find module 'libeay32'. Try using the full path with constructor syntax.
2020-02-03T15:53:57.5188126Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell 
2020-02-03T15:53:57.5188366Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell During handling of the above exception, another exception occurred:
2020-02-03T15:53:57.5188576Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell 
2020-02-03T15:53:57.5188804Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell Traceback (most recent call last):
2020-02-03T15:53:57.5189616Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\shell.py", line 33, in main
2020-02-03T15:53:57.5189974Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     init.InitManager().configure_host()
2020-02-03T15:53:57.5190242Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\init.py", line 177, in configure_host
2020-02-03T15:53:57.5190502Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     stage_success, reboot_required = self._handle_plugins_stage(
2020-02-03T15:53:57.5190817Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\init.py", line 109, in _handle_plugins_stage
2020-02-03T15:53:57.5191042Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     plugins = plugins_factory.load_plugins(stage)
2020-02-03T15:53:57.5191310Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\plugins\factory.py", line 68, in load_plugins
2020-02-03T15:53:57.5192203Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     plugin_cls = cl.load_class(class_path)
2020-02-03T15:53:57.5192574Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\utils\classloader.py", line 29, in load_class
2020-02-03T15:53:57.5192833Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     module = __import__(parts[0], fromlist=parts[1])
2020-02-03T15:53:57.5193103Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\plugins\common\setuserpassword.py", line 24, in <module>
2020-02-03T15:53:57.5193355Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     from cloudbaseinit.utils import crypt
2020-02-03T15:53:57.5193696Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\utils\crypt.py", line 34, in <module>
2020-02-03T15:53:57.5193926Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     openssl = ctypes.cdll.libcrypto
2020-02-03T15:53:57.5194178Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\ctypes\__init__.py", line 443, in __getattr__
2020-02-03T15:53:57.5194418Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     dll = self._dlltype(name)
2020-02-03T15:53:57.5194667Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\ctypes\__init__.py", line 373, in __init__
2020-02-03T15:53:57.5194906Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell     self._handle = _dlopen(self._name, mode)
2020-02-03T15:53:57.5195226Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell FileNotFoundError: Could not find module 'libcrypto'. Try using the full path with constructor syntax.
2020-02-03T15:53:57.5195655Z 2020-02-03 15:53:57.483 1508 ERROR cloudbaseinit.shell �[00m
2020-02-03T15:53:57.5197741Z 2020-02-03 15:53:57.498 1508 CRITICAL cloudbaseinit [-] Unhandled error: FileNotFoundError: Could not find module 'libcrypto'. Try using the full path with constructor syntax.
2020-02-03T15:53:57.5200108Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit Traceback (most recent call last):
2020-02-03T15:53:57.5200459Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\utils\crypt.py", line 32, in <module>
2020-02-03T15:53:57.5200729Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     openssl = ctypes.cdll.libeay32
2020-02-03T15:53:57.5201022Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\ctypes\__init__.py", line 443, in __getattr__
2020-02-03T15:53:57.5201281Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     dll = self._dlltype(name)
2020-02-03T15:53:57.5201698Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\ctypes\__init__.py", line 373, in __init__
2020-02-03T15:53:57.5201969Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     self._handle = _dlopen(self._name, mode)
2020-02-03T15:53:57.5202238Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit FileNotFoundError: Could not find module 'libeay32'. Try using the full path with constructor syntax.
2020-02-03T15:53:57.5202484Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit 
2020-02-03T15:53:57.5202733Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit During handling of the above exception, another exception occurred:
2020-02-03T15:53:57.5202969Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit 
2020-02-03T15:53:57.5203200Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit Traceback (most recent call last):
2020-02-03T15:53:57.5203448Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\Scripts\cloudbase-init-script.py", line 11, in <module>
2020-02-03T15:53:57.5203734Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     load_entry_point('cloudbase-init==0.9.12.dev607', 'console_scripts', 'cloudbase-init')()
2020-02-03T15:53:57.5204016Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\shell.py", line 33, in main
2020-02-03T15:53:57.5204277Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     init.InitManager().configure_host()
2020-02-03T15:53:57.5204548Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\init.py", line 177, in configure_host
2020-02-03T15:53:57.5204811Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     stage_success, reboot_required = self._handle_plugins_stage(
2020-02-03T15:53:57.5205087Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\init.py", line 109, in _handle_plugins_stage
2020-02-03T15:53:57.5205335Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     plugins = plugins_factory.load_plugins(stage)
2020-02-03T15:53:57.5205604Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\plugins\factory.py", line 68, in load_plugins
2020-02-03T15:53:57.5205937Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     plugin_cls = cl.load_class(class_path)
2020-02-03T15:53:57.5206198Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\utils\classloader.py", line 29, in load_class
2020-02-03T15:53:57.5206445Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     module = __import__(parts[0], fromlist=parts[1])
2020-02-03T15:53:57.5206710Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\plugins\common\setuserpassword.py", line 24, in <module>
2020-02-03T15:53:57.5207092Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     from cloudbaseinit.utils import crypt
2020-02-03T15:53:57.5207348Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\site-packages\cloudbaseinit\utils\crypt.py", line 34, in <module>
2020-02-03T15:53:57.5207593Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     openssl = ctypes.cdll.libcrypto
2020-02-03T15:53:57.5207890Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\ctypes\__init__.py", line 443, in __getattr__
2020-02-03T15:53:57.5208140Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     dll = self._dlltype(name)
2020-02-03T15:53:57.5208407Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit   File "C:\hostedtoolcache\windows\Python\3.8.1\x86\lib\ctypes\__init__.py", line 373, in __init__
2020-02-03T15:53:57.5208836Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit     self._handle = _dlopen(self._name, mode)
2020-02-03T15:53:57.5209132Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit FileNotFoundError: Could not find module 'libcrypto'. Try using the full path with constructor syntax.
2020-02-03T15:53:57.5209345Z 2020-02-03 15:53:57.498 1508 ERROR cloudbaseinit �[00m

IBM cloud images do not license with cloud-init versions greater than 0.9.11

Hello.

When creating Windows 2012, Windows 2012R2, Windows 2016, Windows 2019 image templates using cloudbase cloud-init, they do not license correctly when configured to obtain licenses from IBM's KMS servers.

Version 0.9.11 does automatically license with configuration
Versions 1.1.0 & 1.1.1 do not license from the IBM KMS servers

Our configuration files
Unattend.xml

`Jeffreys-MacBook-Pro:iso_dir jeffreyjzarend$ cat Unattend.xml 
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
        <settings pass="generalize">
                <component name="Microsoft-Windows-PnpSysprep" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 
                        xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <PersistAllDeviceInstalls>false</PersistAllDeviceInstalls>
                </component>
        </settings>
        <settings pass="oobeSystem">
                <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 
                        xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
                        <OOBE>
                                <HideEULAPage>true</HideEULAPage>
                                <NetworkLocation>Work</NetworkLocation>
                                <ProtectYourPC>1</ProtectYourPC>
                                <SkipMachineOOBE>true</SkipMachineOOBE>
                                <SkipUserOOBE>true</SkipUserOOBE>
                        </OOBE>
                </component>
        </settings>
        <settings pass="specialize">
                <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" 
                        xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" 
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <RunSynchronous>
                                <RunSynchronousCommand wcm:action="add">
                                        <Order>1</Order>
                                        <Path>cmd.exe /c ""C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\cloudbase-init.exe" --config-file "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init-unattend.conf" &amp;&amp; exit 1 || exit 2"</Path>
                                        <Description>Run Cloudbase-Init to set the hostname</Description>
                                        <WillReboot>OnRequest</WillReboot>
                                </RunSynchronousCommand>
                        </RunSynchronous>
                </component>
        </settings>
</unattend>
Jeffreys-MacBook-Pro:iso_dir jeffreyjzarend$
`

`Jeffreys-MacBook-Pro:iso_dir jeffreyjzarend$ cat cloudbase-init-unattend.conf 
[DEFAULT]
#  "cloudbase-init-unattend.conf" is used during the Sysprep phase
username=Administrator
inject_user_password=true 
first_logon_behaviour=no
config_drive_types=vfat
config_drive_locations=hdd
allow_reboot=false
stop_service_on_exit=false
mtu_use_dhcp_config=false
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
debug=true
log_dir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
log_file=cloudbase-init-unattend.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService
# enabled plugins - executed in order
plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,
        cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,
        cloudbaseinit.plugins.windows.createuser.CreateUserPlugin,
        cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,
        cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin,
        cloudbaseinit.plugins.common.localscripts.LocalScriptsPluginJeffreys-MacBook-Pro:iso_dir jeffreyjzarend$ 
`

Cloudbase-init.conf

`Jeffreys-MacBook-Pro:iso_dir jeffreyjzarend$ cat cloudbase-init.conf 
[DEFAULT]
#  "cloudbase-init.conf" is used for every boot
config_drive_types=vfat
config_drive_locations=hdd
activate_windows=true
kms_host=kms.adn.networklayer.com:1688
mtu_use_dhcp_config=false
real_time_clock_utc=false
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
debug=true
log_dir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
log_file=cloudbase-init.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService
# enabled plugins - executed in order
plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,
        cloudbaseinit.plugins.windows.ntpclient.NTPClientPlugin,
        cloudbaseinit.plugins.windows.licensing.WindowsLicensingPlugin,
        cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,
        cloudbaseinit.plugins.common.userdata.UserDataPlugin,
        cloudbaseinit.plugins.common.localscripts.LocalScriptsPluginJeffreys-MacBook-Pro:iso_dir jeffreyjzarend$ 
`

cloudbase-init under Apache CloudStack

Hi,

I would like to use cloudbase-init for our MS Windows templates in our CloudStack Cloud. However with cloud-init (under Linux systems) we are able to set the password anytime and multiple times. With cloudbase-init it does set the password - but only once. I believe that the cloudbase-init service checks on the VR if a file called saved_password is in there and if so it does not reset the password.

Is there a way or config to let cloudbase-init reset the password as much as I like or is this by design like that?

Regards

hostname '-' is replaced to '0'

hello,

the code hostname = re.sub(r'-$', '0', hostname) in cloudbase-init/utils/hostname.py will replace the last '-' to '0', What does this substitution mean? why is this necessary?

image

Can someone help me please?
Thank you.

Cloudbase-init on Windows stops service which causes an event on Windows Systems

(sorry for opening an issue as I didn't find a mailing list for cloudbase-init)
Cloudbase-init runs the service with startup type Automatic. After a successful run of cloudbase-init the service gets stopped. This causes an alert on Windows Systems as the service has startup type automatic but is no longer running.

Here my question:

  • Can the service be setup as manual?
  • why does the config stop_service_on_exit=false not take effect?

Regards

Support for vendor data in OpenStack clouds

I just used cloud-init to add support for vendor data in our OpenStack clouds for Linux hosts. I wanted to do the same thing for our Windows hosts using cloudbase-init, but I found that this pull request is pending for sometime https://review.opendev.org/c/x/cloudbase-init/+/762870/5
I wanted to know if this will be completed in the near future? Also, this patch is for static vendor data, it would be great to have support for dynamic vendor data alongside this, since it is much much more useful as compared to static vendor data.

Will cloudbase-init be run if attached from an external disk?

I have a question regarding what is installed with when running the cloudbase-init installer.

Is it possible to include everything installed into an external disk, so that whatever machine has this disk attached will be able to start with cloudbase-init?

windows 2012 config ip failed

Hi Team,

When I use cloudbase-init to initialize the Windows 2012 IP address, it always shows that the device is not ready, and the log shows that the name of the network card failed to be modified, but when I entered the system and manually executed the command, it was successful.

can someone help me?

Regards
yuwei

image

Network config plugin can fail if the IP address was already set

After deleting an IP address using PyMI (example here:

existing_address.Delete_()
), verification and a retry/wait usage are needed to make sure the IP address has been removed.

Without the check, the IP address creation can fail with the error MSFT_NetIPAddress already exists at line

conn.MSFT_NetIPAddress.create(

static routes added are not persistent

I added some routes(e.g. 169.254.169.254) with method:

cloudbaseinit.os_utils.windows.WindowsUtils.add_static_route

and found that routes added disappeared after system rebooted or link/bond disabled.

It seems that the method does not support persistent static route rules?

def add_static_route(self, destination, mask, next_hop, interface_index,
                         metric):
        args = ['ROUTE', 'ADD', destination, 'MASK', mask, next_hop]
        (out, err, ret_val) = self.execute_process(args)
        # Cannot use the return value to determine the outcome
        if ret_val or err:
            raise exception.CloudbaseInitException(
                'Unable to add route: %s' % err)

Is there a way with a '-p' option to achieve persistent static route rules?

Windows network persistence

When deploying a Windows 10 1909 image via MAAS and Cloudbase-init 1.1.1 the network settings do not persist.

After initial MAAS deployment the deployed host is accessible. However, when the deployed host is restarted it is not reachable again. It looks like an issue with the network config plugin. Prior to restarting the host I see this in cloudbase-init.log:

2020-06-19 12:15:14.385 3820 INFO cloudbaseinit.init [-] Executing plugin 'NetworkConfigPlugin'
2020-06-19 12:15:14.385 3820 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.osutils.windows.WindowsUtils' load_class C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2020-06-19 12:15:14.385 3820 INFO cloudbaseinit.plugins.common.networkconfig [-] Renaming network adapter "Ethernet0" to "ens192"
2020-06-19 12:15:14.791 3820 DEBUG cloudbaseinit.plugins.common.networkconfig [-] Setting MTU on network adapter "ens192": 1500 _process_link_common C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py:182
2020-06-19 12:15:14.791 3820 DEBUG cloudbaseinit.osutils.windows [-] Setting MTU for interface "ens192" with value "1500" set_network_adapter_mtu C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\osutils\windows.py:843
2020-06-19 12:15:14.838 3820 DEBUG cloudbaseinit.plugins.common.networkconfig [-] Enable network adapter "ens192": True _process_link_common C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py:187
2020-06-19 12:15:14.900 3820 INFO cloudbaseinit.plugins.common.networkconfig [-] Setting static IP configuration on network adapter "ens192". IP: 198.90.245.252, prefix length: 24, gateway: 198.90.245.1, dns: ['198.90.245.16', '198.61.86.53']
2020-06-19 12:15:14.963 3820 DEBUG cloudbaseinit.osutils.windows [-] Removing existing IP address "198.90.245.252" from adapter "ens192" _set_static_network_config C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\osutils\windows.py:980
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init [-] plugin 'NetworkConfigPlugin' failed with error '<x_wmi: The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". (-2144108526, 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".', (0, None, 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".', None, None, -2144108526), None)>': wmi.x_wmi: <x_wmi: The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". (-2144108526, 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".', (0, None, 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".', None, None, -2144108526), None)>
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init [-] <x_wmi: The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". (-2144108526, 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".', (0, None, 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".', None, None, -2144108526), None)>: wmi.x_wmi: <x_wmi: The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". (-2144108526, 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".', (0, None, 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".', None, None, -2144108526), None)>
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init Traceback (most recent call last):
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\wmi\__init__.py", line 98, in func_wrapper
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     return func(*args, **kwargs)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\wmi\__init__.py", line 50, in wrapper
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     return f(*args, **kwargs)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\wmi\__init__.py", line 722, in delete_instance
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     operation_options)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init PyMI.error: {'error_code': 2150858770, 'mi_result': 1, 'message': 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".'}
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init 
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init During handling of the above exception, another exception occurred:
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init 
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init Traceback (most recent call last):
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\init.py", line 67, in _exec_plugin
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     shared_data)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 307, in execute
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     return self._process_network_details_v2(network_details)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 300, in _process_network_details_v2
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     osutils, network_details)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 286, in _process_networks
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     net.link, ip_address, prefix_len, gateway, nameservers)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\osutils\windows.py", line 1005, in set_static_network_config
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     name, address, prefix_len, gateway)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\osutils\windows.py", line 981, in _set_static_network_config
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     existing_address.Delete_()
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\wmi\__init__.py", line 98, in func_wrapper
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     return func(*args, **kwargs)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\wmi\__init__.py", line 312, in Delete_
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     self._conn.delete_instance(self, operation_options)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\wmi\__init__.py", line 111, in func_wrapper
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init     raise x_wmi(err_msg, com_ex)
2020-06-19 12:15:19.088 3820 ERROR cloudbaseinit.init wmi.x_wmi: <x_wmi: The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig". (-2144108526, 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".', (0, None, 'The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".', None, None, -2144108526), None)>

Post restart the cloudbase-init.log contains:

2020-06-19 12:20:57.994 3788 DEBUG cloudbaseinit.metadata.services.base [-] Executing http request GET at http://198-90-245-0--24.maas-internal:5248/MAAS/metadata/2012-03-01/meta-data/ _http_request C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\metadata\services\base.py:315
2020-06-19 12:20:57.994 3788 DEBUG urllib3.connectionpool [-] Starting new HTTP connection (1): 198-90-245-0--24.maas-internal:5248 _new_conn C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\urllib3\connectionpool.py:225
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base [-] HTTPConnectionPool(host='198-90-245-0--24.maas-internal', port=5248): Max retries exceeded with url: /MAAS/metadata/2012-03-01/meta-data/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025DD7525668>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)): requests.exceptions.ConnectionError: HTTPConnectionPool(host='198-90-245-0--24.maas-internal', port=5248): Max retries exceeded with url: /MAAS/metadata/2012-03-01/meta-data/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025DD7525668>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base Traceback (most recent call last):
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\urllib3\connection.py", line 157, in _new_conn
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     (self._dns_host, self.port), self.timeout, **extra_kw
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\socket.py", line 745, in getaddrinfo
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base socket.gaierror: [Errno 11001] getaddrinfo failed
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base 
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base During handling of the above exception, another exception occurred:
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base 
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base Traceback (most recent call last):
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\urllib3\connectionpool.py", line 672, in urlopen
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     chunked=chunked,
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\urllib3\connectionpool.py", line 387, in _make_request
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     conn.request(method, url, **httplib_request_kw)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\http\client.py", line 1239, in request
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     self._send_request(method, url, body, headers, encode_chunked)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\http\client.py", line 1285, in _send_request
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     self.endheaders(body, encode_chunked=encode_chunked)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\http\client.py", line 1234, in endheaders
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     self._send_output(message_body, encode_chunked=encode_chunked)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\http\client.py", line 1026, in _send_output
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     self.send(msg)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\http\client.py", line 964, in send
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     self.connect()
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\urllib3\connection.py", line 184, in connect
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     conn = self._new_conn()
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\urllib3\connection.py", line 169, in _new_conn
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     self, "Failed to establish a new connection: %s" % e
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000025DD7525668>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base 
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base During handling of the above exception, another exception occurred:
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base 
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base Traceback (most recent call last):
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\requests\adapters.py", line 449, in send
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     timeout=timeout
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\urllib3\util\retry.py", line 436, in increment
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     raise MaxRetryError(_pool, url, error or ResponseError(cause))
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='198-90-245-0--24.maas-internal', port=5248): Max retries exceeded with url: /MAAS/metadata/2012-03-01/meta-data/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025DD7525668>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base 
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base During handling of the above exception, another exception occurred:
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base 
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base Traceback (most recent call last):
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\metadata\services\base.py", line 325, in _get_data
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     response = self._http_request(path)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\metadata\services\maasservice.py", line 108, in _http_request
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     method)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\metadata\services\base.py", line 318, in _http_request
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     verify=self._verify_https_request())
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\requests\api.py", line 61, in request
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     return session.request(method=method, url=url, **kwargs)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\requests\sessions.py", line 530, in request
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     resp = self.send(prep, **send_kwargs)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\requests\sessions.py", line 643, in send
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     r = adapter.send(request, **kwargs)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\requests\adapters.py", line 516, in send
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base     raise ConnectionError(e, request=request)
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base requests.exceptions.ConnectionError: HTTPConnectionPool(host='198-90-245-0--24.maas-internal', port=5248): Max retries exceeded with url: /MAAS/metadata/2012-03-01/meta-data/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025DD7525668>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))
2020-06-19 12:20:57.994 3788 ERROR cloudbaseinit.metadata.services.base 
2020-06-19 12:21:01.994 3788 DEBUG cloudbaseinit.metadata.services.maasservice [-] Getting authorization headers for http://198-90-245-0--24.maas-internal:5248/MAAS/metadata/2012-03-01/meta-data/. _get_oauth_headers C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\metadata\services\maasservice.py:89
2020-06-19 12:21:01.994 3788 DEBUG cloudbaseinit.metadata.services.base [-] Executing http request GET at http://198-90-245-0--24.maas-internal:5248/MAAS/metadata/2012-03-01/meta-data/ _http_request C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\metadata\services\base.py:315
2020-06-19 12:21:01.994 3788 DEBUG urllib3.connectionpool [-] Starting new HTTP connection (1): 198-90-245-0--24.maas-internal:5248 _new_conn C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\urllib3\connectionpool.py:225
2020-06-19 12:21:01.994 3788 ERROR cloudbaseinit.metadata.services.base [-] HTTPConnectionPool(host='198-90-245-0--24.maas-internal', port=5248): Max retries exceeded with url: /MAAS/metadata/2012-03-01/meta-data/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025DD75254A8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)): requests.exceptions.ConnectionError: HTTPConnectionPool(host='198-90-245-0--24.maas-internal', port=5248): Max retries exceeded with url: /MAAS/metadata/2012-03-01/meta-data/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000025DD75254A8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))

I'm guessing that the errors in the log post-restart are a direct result of the pre-restart failure.

Python 3.8 Warnings/Error

I'm trying to use Python 3.8 in Windows, and while running python setup.py install is gave some warnings/errors that should be reviewed:

C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\metadata\services\osconfigdrive\test_factory.py:38: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if platform is not "win32":

byte-compiling C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\osutils\test_windows.py to test_windows.cpython-38.pyc
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\osutils\test_windows.py:323: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if ret_value is not 0 and is_in_alias:

byte-compiling C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py to test_winrmconfig.cpython-38.pyc
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:87: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if tag is "ListeningOn":
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:89: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif tag is "Enabled":
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:90: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if text is 'true':
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:96: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif tag is 'Port':
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:145: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if tag is "Enabled":
C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\tests\utils\windows\test_winrmconfig.py:146: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if text is 'true':

Can these be fixed like python is suggesting?

Also there's an issue with using the async reserved keyword as a variable:

byte-compiling C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py to vds_storage_manager.cpython-38.pyc
  File "C:\Users\vagrant\test\cbi\Lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 94
    async = volume.Extend(input_disks_ar, len(input_disks))
          ^
SyntaxError: invalid syntax

Should I post a PR fixing these?

cloudbase-init config script works inconsistently using azure shared gallery image and azure java client

I have created a windows 2012 R2 azure image with cloudbase-init installed. My intention is to run a script while starting any new VM instance using this image. My cloud config script contains powershell script basically starting with #ps1sysnative. This has been working fine for a while now.

I have moved my azure base image to shared image gallery. Now, when I am creating an instance using the complete image url of latest image present in shared image gallery, I run into one issue. I am passing the same cloud config script. But, what is happening is that I can start new machine with cloud config script executed during startup while doing so using azure cli but while making create instance call using azure java client (basically method https://docs.microsoft.com/en-us/java...) and passing cloud config using https://docs.microsoft.com/en-us/java..., at time cloudbase-init runs the cloud config powershell script but after a while it is not running this script, that custom data is getting dumped into azure machine as customdata.bin. All cofiguration is same and the same flow works if I give the base image id and not the one present in shared gallery.

Cloud-config script is something like this:

#ps1_sysnative

$example = ‘test’

(Get-Content -Path C:\testData) |
  ForEach-Object {$_ -Replace ‘{example}‘, $example} |
    Set-Content -Path C:\testData

Not sure why this weird behaviour when using shared gallery image and azure java client. I am not making any changes but running into this weird behaviour. Kindly assist.

Metadata OvfService - Unsupported user_data format

UserData is not being interpreted correctly when using OvfService:
WARNING cloudbaseinit.plugins.common.userdatautils [-] Unsupported user_data format

cloudbase-init.log

2020-10-20 20:30:56.659 2324 INFO cloudbaseinit.init [-] Executing plugin 'UserDataPlugin'
2020-10-20 20:30:56.659 2324 DEBUG cloudbaseinit.plugins.common.userdata [-] User data content length: 97 execute C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\userdata.py:50
2020-10-20 20:30:56.659 2324 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.utils.template_engine.jinja2_template.Jinja2TemplateEngine' load_class C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2020-10-20 20:30:57.034 2324 WARNING cloudbaseinit.plugins.common.userdatautils [-] Unsupported user_data format
2020-10-20 20:30:57.034 2324 INFO cloudbaseinit.init [-] Plugins execution done
2020-10-20 20:30:57.034 2324 INFO cloudbaseinit.init [-] Stopping Cloudbase-Init service

ovf-env.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Environment
     xmlns="http://schemas.dmtf.org/ovf/environment/1"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:oe="http://schemas.dmtf.org/ovf/environment/1"
     xmlns:ve="http://www.vmware.com/schema/ovfenv"
     oe:id=""
     ve:vCenterId="vm-584159">
   <PlatformSection>
      <Kind>VMware ESXi</Kind>
      <Version>6.7.0</Version>
      <Vendor>VMware, Inc.</Vendor>
      <Locale>en</Locale>
   </PlatformSection>
   <PropertySection>
         <Property oe:key="password" oe:value="Password1234!"/>
         <Property oe:key="user-data" oe:value="eyJ3cml0ZV9maWxlcyI6eyJjb250ZW50IjoiQ2xvdWRiYXNlLUluaXQtdGVzdCIsInBhdGgiOiJDOlxcdGVzdC50eHQifSwic2V0X2hvc3RuYW1lIjoidGVzdG5hbWUifQ=="/>
         <Property oe:key="username" oe:value="Administrator"/>
   </PropertySection>
   <ve:EthernetAdapterSection>
      <ve:Adapter ve:mac="00:50:56:bb:a0:3c" ve:network="rck3236trunk" ve:unitNumber="7"/>
   </ve:EthernetAdapterSection>
</Environment>

base64 decoded user-data seems valid.

"write_files":{"content":"Cloudbase-Init-test","path":"C:\\test.txt"},"set_hostname":"testname"}

the above is generated by VMware vRealize 8.1 blueprint yaml:

      cloudConfig:
        #cloud-config
        write_files:
          content: Cloudbase-Init-test
          path: 'C:\test.txt'
        set_hostname: testname

Domain join userdata module

For domain joining windows nodes, it would be convenient to have a userdata module. Currently, this could be done through the cloudbase-init-unattend.xml, local scripts plugin, or write_files / runcmd.

Something like:

#cloud-config
domain_join:
  domain_name: domain
  ou_path: ou
  server: server
  username: username
  password: password

Implement cloud-config 'write_files' support

Currently, cloud-config 'write_files' has partial support in cloudbase-init.

The following sub-features are not implemented:

  • append (bool: False) - if set, the content given should be appended to the file

Cloud-init docs for 'write_files':
https://cloudinit.readthedocs.io/en/latest/topics/examples.html#writing-out-arbitrary-files

Example cloud-config userdata to be supported:

#cloud-config
write_files:
  -
    encoding: b64
    content: CiMgVGhpcyBmaWxlIGNvbnRyb2xzIHRoZSBzdGF0ZSBvZiBTRUxpbnV4
    owner: Administrator
    path: 'C:\\test_file'
    permissions: '0644'
  -
    content: "# Example ps1 file\necho 'test'\n"
    path: 'C:\\test_file.ps1'
  -
    encoding: gzip
    content: null
    path: 'C:\\test_binary'
    permissions: '0555'
  -
    content: "added to file\n"
    path: 'C:\\test_append'
    append: true

The key 'owner' will not be implemented on Windows, as there is of little use. The owner of the file will be LocalSystem or the user under which cloudbase-init service runs (defaults to cloudbase-init user, which is an Administrator).

Windows Server 2019 with Cloudbase-init Keeps Rebooting after Provisioning

Hello

I have prepared a Windows Server 2019 Template with Cloudbase-init on vSphere. and currently after provisioning the VM, it keep rebooting in a continuous loop .

Even if I convert the template that I prepared back to a VM and boot it up i m seeing the same thing.

Wondering if anyone seen this behaviour or know if Windows Server 2019 is even supported

Fix error message when userdata header is not supported

Given userdata in the following format:

#!not_existent_binary_in_the_path
do_something

the logs look like this:

2020-04-23 06:57:21.907 4232 INFO cloudbaseinit.init [-] Executing plugin 'UserDataPlugin'
2020-04-23 06:57:21.985 4232 DEBUG cloudbaseinit.plugins.common.userdata [-] User data content length: 12 execute C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\userdata.py:50
2020-04-23 06:57:22.016 4232 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.utils.template_engine.jinja2_template.Jinja2TemplateEngine' load_class C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2020-04-23 06:57:22.518 4232 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.osutils.windows.WindowsUtils' load_class C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2020-04-23 06:57:22.558 4232 WARNING cloudbaseinit.plugins.common.userdatautils [-] An error occurred during user_data execution: '[WinError 2] The system cannot find the file specified': FileNotFoundError: [WinError 2] The system cannot find the file specified
2020-04-23 06:57:22.579 4232 INFO cloudbaseinit.plugins.common.userdatautils [-] User_data script ended with return code: 0

The log messages do not reveal the actual issue of not having the binary in the path.

Implement cloud-config 'users' and 'groups' support

Cloud-init docs for groups and users:

https://cloudinit.readthedocs.io/en/latest/topics/examples.html#including-users-and-groups

Example userdata file:

#cloud-config
 
# Add groups to the system
# The following example adds the ubuntu group with members 'root' and 'sys'
# and the empty group cloud-users.
groups:
  - ubuntu: [root,sys]
  - cloud-users

# Add users to the system. Users are added after groups are added.
users:
  - name: foobar
    gecos: Foo B. Bar
    primary_group: foobar
    groups: users
    passwd: StrongPassw0rd
    inactive: False
    expiredate: 2020-10-01
    ssh_authorized_keys:
      - ssh first key
      - ssh second key

The keys following keys are not implemented:

  • homedir - won't do
  • lock_passwd - won't do
  • ssh_redirect_user - won't do
  • ssh_import_id - won't do
  • shell - won't do
  • no_log_init - not a Windows featur
  • no_user_group - not a Windows feature
  • selinux_user - not a Windows feature
  • snapuser - not a Windows feature
  • sudo - not a Windows feature
  • system - not a Windows feature
  • uid - not a Windows feature

windows 10 1909 and 1903 build issue

Hi Team,
I'm trying to build windows 10 1909 build using cloudbase tool, the image creation happens successfully, after uploading the image to openstack and when i try to create a VM from the image i get the below error.

"windows setup experienced an unexpected error to install windows restart the installation"

can someone help me

Regards
vijay
image (4)

admin_pass via MAAS

I can successfully use an SSL certificate and WinRM to set the Admin user password after a Windows image has been deployed by MAAS.

I understand that setting it via meta data is not really "secure", but that works in our trusted environment. I've tried with the following user data passed in to user_data as a base64 encoded string:

#cloud-config

cloudbase-config
admin_pass: password

with cloudbase-init.conf:

[DEFAULT]
username=Admin
groups=Administrators
inject_user_password=true
first_logon_behaviour=no
config_drive_raw_hhd=true
config_drive_cdrom=true
config_drive_vfat=true
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
verbose=true
debug=true
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
logfile=cloudbase-init.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
logging_serial_port_settings=COM1,115200,N,8
mtu_use_dhcp_config=true
ntp_use_dhcp_config=true
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\

and cloudbase-init-unattend.conf:

[DEFAULT]
username=Admin
groups=Administrators
inject_user_password=true
first_logon_behaviour=no
config_drive_raw_hhd=true
config_drive_cdrom=true
config_drive_vfat=true
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
verbose=true
debug=true
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
logfile=cloudbase-init-unattend.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
logging_serial_port_settings=COM1,115200,N,8
mtu_use_dhcp_config=true
ntp_use_dhcp_config=true
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService,cloudbaseinit.metadata.services.httpservice.HttpService,cloudbaseinit.metadata.services.ec2service.EC2Service,cloudbaseinit.metadata.services.maasservice.MaaSHttpService
plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin
allow_reboot=false
stop_service_on_exit=false
check_latest_version=false

But each time I'm still prompted to change the password when host first boots. This is problematic for us as the devices are headless Intel NUCs with no IPMI (we are using a custom Eaton power driver to control power state - see: https://code.launchpad.net/~adacre/maas/+git/maas/+merge/377439)

cannot parse OpenNebula 5.12 metadata correctly

exists empty string in OpenNebula 5.12.0.1 context.sh.
like this

ETH0_GATEWAY6=''

but not considered empty string current metadata parser.

pattern = (br"(?P<key>\w+)=(['\"](?P<str_value>[\s\S]+?)['\"]|"
br"(?P<int_value>\d+))(?=\s+\w+=)")
for match in re.finditer(pattern, new_content):
key = encoding.get_as_string(match.group("key"))
pairs[key] = (match.group("str_value") or
int(match.group("int_value")))

in result cannnot parse Opennebula 5.12 metadata correctly.

sample context.sh
context.txt

Network is in a disconnected state when using cloudbase-init and Static IP network assignment

would appreciate any help from the cloudbase-init team on this .

Provisioning a VM from a template prepped with cloudbase-init and the OVF service on vSphere via an automation tool that maps userdata using CD-ROM mapped iso works fine if we use DHCP network assignment since in this use case there is no VM customization event which is again is not needed since the template is syspreped.

Problem is when we try to use a static IP the automation tool generate a dynamic customization Specification which forces VM Customization on the provisioned VM . in this use case the customization event fails with an error on the VM in vCenter:

"The customization component failed to set the required parameters inside the guest operating system"

looking in the c:/windows/temp/vmware-imc/guestcust.log I really cloudn't tell what is that required parameters its talking about.

Log Files attached
guestcust.log
cloudbase-init.log

because of this customization error the network adapter stays in a disconnected state which is problematic even though the IP is configured correctly within the GOS but whats strange cloudbase-init is clearing the gateway, so its not set.

Can cloudbase-init handle something like vSphere Customization ?

how to disable the creation of the default Admin user?

My base image already has an administrator (the vagrant user) with a specific password and I do not want to change it or create a new administrator user.

To disable this behavior do I have to somehow blacklist the following plugins or is there other way?

cloudbaseinit.plugins.windows.createuser.CreateUserPlugin                                                                       
cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin                                                              

Does cloudbase-init internally (or its plugins) use/need this user? Or is this just an user that will be used by an human?


For reference this is how I got the default plugins:

$cloudbaseInitHome = 'C:\Program Files\Cloudbase Solutions\Cloudbase-Init'
&"$cloudbaseInitHome\Python\python.exe" -c 'import json, sys; from cloudbaseinit import conf; json.dump(conf.CONF.plugins, sys.stdout)' | ConvertFrom-Json

And currently, this list is:

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                 

Implement cloud-config 'ntp' support

Example userdata file:

ntp:
  enabled: True
  pools: ['0.company.pool.ntp.org', '1.company.pool.ntp.org', 'ntp.myorg.org']
  servers: ['my.ntp.server.local', 'ntp.ubuntu.com', '192.168.23.2']

The keys ntp_client and config will not be implemented on Windows, as there is only one client with one way to configure it.

file is in use by another program and cannot be accessed by the process

When I apply citrix,an error will occur when restart computer, cloudbase-init localscripts execute failed

ERROR cloudbaseinit.metadata.factory [-] Cannot open file: '另一个程序正在使用此文件,进程无法访问。'
ERROR cloudbaseinit.metadata.factory cloudbaseinit.exception.WindowsCloudbaseInitException: Cannot open file: '另一个程序正在使用此文件,进程无法访问。'

cloudbase-init.log as follow:
https://win-1252076932.cos.ap-shanghai.myqcloud.com/ins-01226xns_cloudbase-init.log
https://win-1252076932.cos.ap-shanghai.myqcloud.com/ins-q02dze3s_cloudbase-init.log

When the file to be called is occupied by other programs, cloudbase-init should wait for the file to be released. For example, if the file is occupied for 3 minutes or much longer time, at that time the failed result is more acceptable.

extend volum failed on windows10

Dear Experts:
I was created windows10.qcow2 and install cloudinit-base on windows10_x64.iso

windows10 version:latest 2021-05.
virtio version:virtio-win-0.1.196.iso

cloudbase-init version:CloudbaseInitSetup_1_1_2_x64

cloudbase-init.conf
[DEFAULT]
username=jenkins
groups=Administrators
inject_user_password=false
config_drive_raw_hhd=true
config_drive_cdrom=true
config_drive_vfat=true
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin
verbose=true
debug=true
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log
logfile=cloudbase-init.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
logging_serial_port_settings=COM1,115200,N,8
mtu_use_dhcp_config=true
ntp_use_dhcp_config=true
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts
check_latest_version=true

But when boot on openstack return as below error:
2021-07-12 07:56:02.477 2564 INFO cloudbaseinit.init [-] Executing plugin 'SetUserSSHPublicKeysPlugin'
2021-07-12 07:56:02.477 2564 DEBUG cloudbaseinit.metadata.services.base [-] Using cached copy of metadata: 'openstack/latest/meta_data.json' _get_cache_data C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\metadata\services\base.py:74
2021-07-12 07:56:02.493 2564 DEBUG cloudbaseinit.plugins.common.sshpublickeys [-] Public keys not found in metadata execute C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\sshpublickeys.py:34
2021-07-12 07:56:02.493 2564 INFO cloudbaseinit.init [-] Executing plugin 'ExtendVolumesPlugin'
2021-07-12 07:56:02.508 2564 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.osutils.windows.WindowsUtils' load_class C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2021-07-12 07:56:02.524 2564 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.utils.windows.storage.vds_storage_manager.VDSStorageManager' load_class C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2021-07-12 07:56:06.712 2564 INFO cloudbaseinit.utils.windows.storage.vds_storage_manager [-] Extending volume "\?\GLOBALROOT\Device\HarddiskVolume2" with 351232 bytes
2021-07-12 07:56:06.727 2564 ERROR cloudbaseinit.init [-] plugin 'ExtendVolumesPlugin' failed with error '(-2147212237, None, (None, None, None, 0, None))': _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None))
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init [-] (-2147212237, None, (None, None, None, 0, None)): _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None))
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init Traceback (most recent call last):
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\init.py", line 67, in _exec_plugin
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init shared_data)
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\windows\extendvolumes.py", line 30, in execute
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init storage_manager.extend_volumes(volumes_indexes)
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 147, in extend_volumes
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init self._extend_volumes(pack, volume_indexes)
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 63, in _extend_volumes
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init self._extend_volume(pack, volume, volume_prop)
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\windows\storage\vds_storage_manager.py", line 94, in _extend_volume
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init extend_job = volume.Extend(input_disks_ar, len(input_disks))
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init _ctypes.COMError: (-2147212237, None, (None, None, None, 0, None))
2021-07-12 07:56:06.742 2564 ERROR cloudbaseinit.init

Static routes existing in ConfigDrive are not applied

Hi,

I'm provisioning a Windows image by ConfigDrive with bellow openstack/latest/network_data.json:

{
  "links": [
    {
      "id": "default-windows-eth1",
      "name": "eth1",
      "type": "vif",
      "ethernet_mac_address": "0e:16:9b:84:61:fd",
      "mtu": 1500
    }
  ],
  "networks": [
    {
      "id": "default-windows-eth1",
      "type": "ipv4",
      "link": "default-windows-eth1",
      "ip_address": "10.101.0.234",
      "netmask": "255.255.255.0",
      "routes": [
        {
          "network": "172.19.2.0",
          "netmask": "255.255.255.0",
          "gateway": "10.101.0.1"
        }
      ]
    }
  ],
  "services": [
    {
      "type": "dns",
      "address": "1.1.1.1"
    },
    {
      "type": "dns",
      "address": "8.8.8.8"
    }
  ]
}

I expect a route to 172.19.2.0/24 being set, but it's all I'd get in Windows:

network_data

I read openstack and configdrive tests and looks routes being parsed correctly but I don't see any test targeting routes in cloudbaseinit/tests/osutils/test_windows.py and they are all about static network address setting. Further investigation showed NetworkConfigPlugin itself just set network interface IP addresses and consequently just local routes. There is add_static_route function but looks it's unrelated to my case which datasource is ConfigDrive.

So IIUC ConfigDrive Network Routes are being ignored now. Am I right?

MSIs for v1.1.0?

Can the MSIs for the v1.1.0 release be added to the release artifacts?

How to modify the name of default Admin user?

I tried to change the name of default admin user from Admin to Administrator, but it didn't take any effect, here is my cloudbase-init.conf:

[DEFAULT]
username=Administrator
groups=Administrators
inject_user_password=true
config_drive_raw_hhd=true
config_drive_cdrom=true
config_drive_vfat=true
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
verbose=true
debug=true
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
logfile=cloudbase-init.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
logging_serial_port_settings=
mtu_use_dhcp_config=true
ntp_use_dhcp_config=true
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\

My main purpose is to enable Administrator account on my Windows10, and remove all other users, and whatever I did so far, I got two account (Admin and Administrator) on my image, any suggestion?

add support for cloud-init drive as created by libvirt_cloudinit_disk

I would like to use the cloud-init disk generated by https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/cloudinit.html.markdown. I have an ubuntu regular cloud-init example usage at https://github.com/rgl/terraform-libvirt-ubuntu-example which I'm trying to port to windows.

Essentially, terraform-provider-libvirt creates a iso which is attached as a cd-rom to the VM. The cd-rom label is cidata and the root directory has the following files:

  • meta-data
  • network-config
  • user-data

As displayed by Windows Explorer:

image

I've tried to follow the cloudbase-init codebase and ended up at

if label and label.lower() == CONFIG_DRIVE_LABEL and \
os.path.exists(os.path.join(drive,
'openstack\\latest\\'
'meta_data.json')):
which checks for the label and some files. Is this the best place to add support for the cloud-init? or is it better to create an entire new metadata service class?

Problem to set password in Windows 10/Server 2016/Server 2019 (Proxmox 6.1)

Greetings!

Using Proxmox version 6.1, I had a problem setting a password in Windows 10 (and Server 2016/Server 2019 too). I use the "OpenStack (configuration drive)" service to collect meta data from Cloud-Init. сloudbase-init.conf settings:

[DEFAULT]
username=Venom
groups=Administrators
inject_user_password=true
first_logon_behaviour=no
config_drive_raw_hhd=true
config_drive_cdrom=true
config_drive_vfat=true
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin
verbose=true
debug=true
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log
logfile=cloudbase-init.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
logging_serial_port_settings=
mtu_use_dhcp_config=true
ntp_use_dhcp_config=true
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService
plugins=cloudbaseinit.plugins.common.networkconfig.NetworkConfigPlugin, cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin
allow_reboot=false
stop_service_on_exit=false

Using cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin plugin, the password is incorrect. As a result, it is impossible to log into the system, each time receiving an error about the wrong password.
We see the following information in the logs (I provide the part where the SetUserPasswordPlugin plugin is worked out):

2020-02-11 13:02:00.909 2956 INFO cloudbaseinit.init [-] Executing plugin 'SetUserPasswordPlugin'
2020-02-11 13:02:00.909 2956 DEBUG cloudbaseinit.utils.classloader [-] Loading class 'cloudbaseinit.osutils.windows.WindowsUtils' load_class C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\utils\classloader.py:27
2020-02-11 13:02:00.924 2956 DEBUG cloudbaseinit.metadata.services.base [-] Using cached copy of metadata: 'openstack/latest/meta_data.json' _get_cache_data C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\metadata\services\base.py:74
2020-02-11 13:02:00.924 2956 DEBUG cloudbaseinit.plugins.common.setuserpassword [-] Generating a random user password _set_password C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\plugins\common\setuserpassword.py:87
2020-02-11 13:02:00.956 2956 INFO cloudbaseinit.plugins.common.setuserpassword [-] Password succesfully updated for user Venom
2020-02-11 13:02:00.971 2956 INFO cloudbaseinit.plugins.common.setuserpassword [-] Cannot set the password in the metadata as it is not supported by this service
2020-02-11 13:02:00.971 2956 DEBUG cloudbaseinit.metadata.services.configdrive [-] Deleting metadata folder: 'C:\Windows\TEMP\tmp1cipklhi' cleanup C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\lib\site-packages\cloudbaseinit\metadata\services\configdrive.py:86
2020-02-11 13:02:00.971 2956 INFO cloudbaseinit.init [-] Plugins execution done

It turns out that no matter what password is set, a random password will be set immediately after reading the password from the meta data.

Perhaps I made a mistake somewhere in the cloudbase-init.conf settings? However, other plugins work correctly (except for cloudbaseinit.plugins.windows.createuser.CreateUserPlugin).

Userdata part text/x-shellscript fails to be executed when no file_name is provided

Userdata MIME part type text/x-shellscript can have an optional file_name.
Currently, if the file_name does not exist, cloudbase-init throws an error and does not execute the script.

The fix should be easy, in case no or empy filename is provided, a random file name should be used for temporary usage.

Initial bug report: https://ask.cloudbase.it/question/3228/failure-running-multipart-shellscript-with-terraform-and-openstack/

New Release?

When is a new release planned? I would like to have the Networking Config Version 1 available with the NoCloud service (done in commit 246db50), as specified in the documentation...

add retries for get_network_adapter_name_by_mac_address

for my testes, sometimes cloudbase-init can't initialize interface correctly, and lookup the log we can see the exception as below

2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init [-] plugin 'NetworkConfigPlugin' failed with error 'Network interface with MAC address "24:6e:96:27:d4:38" not found': cloudbaseinit.exception.ItemNotFoundException: Network interface with MAC address "24:6e:96:27:d4:38" not found
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init [-] Network interface with MAC address "24:6e:96:27:d4:38" not found: cloudbaseinit.exception.ItemNotFoundException: Network interface with MAC address "24:6e:96:27:d4:38" not found
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init Traceback (most recent call last):
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\init.py", line 67, in _exec_plugin
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init     shared_data)
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 307, in execute
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init     return self._process_network_details_v2(network_details)
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 296, in _process_network_details_v2
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init     osutils, network_details)
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 198, in _process_physical_links
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init     link.mac_address)
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\osutils\windows.py", line 752, in get_network_adapter_name_by_mac_address
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init     mac_address)
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init cloudbaseinit.exception.ItemNotFoundException: Network interface with MAC address "24:6e:96:27:d4:38" not found
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init 

I guess this is because when cloud-init run, the NICs are don't seen by OS, so we should add more retries here, just like this commint
41161e5

Multiple NIC password services failed from cloudstack

HI
When the VM has multiple NICs, the password cannot be obtained from the correct meta data server

If a VM has >1 NIC, there will only be one NIC called Default NIC;
Cloudstack will only store the vm password on the VR where the Default NIC is located
But the meta data will be stored on the VR corresponding to all NICs;

The current verification method of cloudbase-init is:

As long as the meta data service-offering can be obtained from the dhcp server, it is considered that it can provide password services;
https://github.com/cloudbase/cloudbase-init/blob/master/cloudbaseinit/metadata/services/cloudstack.py#L67

This is not correct

Password services should be individually verified

must change password on first boot

As shown in the figure below, after the first initialization is completed, the password must be changed,but I have configured first_logon_behaviour=no in cloudbase-init.conf & cloudbase-init-unattend.conf.

image
The first text box is the admin_pass value set in meta_data.json, the second text box is the new password to be configured, and the third text box is to confirm the new password.
image

Can someone help me please?
Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.