Uses InitiateSystemShutdownExW instead of InitiateSystemShutdownW.
This is needed for Nano Server support.
Change-Id: I7ca30de01966cd37b0627ad9eddfd332b8260f62
Closes-Bug: #1494529
VerifyWindowsVersion requires a manifest on Windows 10, not a
suitable option in Python.
This patch replaces VerifyWindowsVersion with RtlVerifyWindowsVersion.
Co-Authored-By: Cosmin Poieana <cpoieana@cloudbasesolutions.com>
Change-Id: I6f9414a44aab97b15359ae4b4ca9cc1777b396f8
Closes-Bug: #1493324
This is needed for Nano Server compatibility
Closes-Bug: #1493150
Co-Authored-By: Cosmin Poieana <cpoieana@cloudbasesolutions.com>
Change-Id: Id805e8e96f749567f34435816d43f571b44bdb4a
Since a couple of releases ago, the old oslo.config is now
oslo_config, the same thing happening to oslo.log as well.
This patch also removes the vendorized openstack package,
since it's redundant now that oslo_log is out of the
incubator.
Change-Id: Iae1318aa0d2a9aab2d4f6af7d11ed1dfda51e733
This patch exports a new option, `password_next_logon`, which determines
what will happen at the next logon in certain conditions. The option
can accept three possible arguments: `always`, which forces the user
to change the password at next logon, 'no', which doesn't change anything
and `clear_text_injected_only`, which forces the user to change the password
at the next logon if the password comes in clear text from the metadata.
Change-Id: Ic6a0526ea9c9902e183898c42497133a135b5c53
This patch improves _get_ipv4_forward_table by doing only
one call to iphlpapi.GetIpForwardTable. Previously two calls were
made, where the second call should have been called only when
the first one failed with INSUFFICIENT_BUFFER. This patch also
adds tests for _get_ipv4_forward_table, which was previously
untested.
Change-Id: I5728948557e749d0e0005a9d90c12e4093dc3307
* proper parsing of network content metadata, including v6 support
* v6 addresses static network configuration support (address, netmask, gateway)
* remove redundant code in networkconfig and osutils network related tests
Change-Id: Ieb2c18e29d0c275feb3a03e7340b3c91327705ba
cloud-config supports a new plugin, called 'set-timezone', which
can be used to change the timezone on the underlying instance.
The patch adds a new method in the osutils abstraction, called `set_timezone`,
which should be implemented by each separated OS. The abstraction calls
into cloudbaseinit.utils.windows.timezone, another layer of abstraction
over two API methods, SetTimeZoneInformation for Windows 2003 and older
and SetDynamicTimeZoneInformation, for newer versions of Windows,
which also handles Daylight Saving Time.
The plugin supports standard IANA timezone names, which are then translated
to the Windows-specific timezone names, using tzlocal library.
Change-Id: I18674e1ae078fc69f3fb938065ba01a4de5464a1
Due to mock.Mock's nature, using an undefined method will not result
in an AttributeError, since the object will be created silently. This
changed in Python 3.5, where accessing a member which doesn't exist
will raise an AttributeError explicitly. This uncovered a couple of bugs
in the test suite.
Change-Id: Idbfa92d82b01ff4710dfdd4556500b5c61d20db6
This patch adds a type of exception for the Windows code, which interpolates
the given exception message with the last Windows API error, retrieved with
ctypes.GetLastError. This is useful in the case where we have only the log
at our disposal for debugging and some API method failed with reasons unknown.
Since we can't replicate what the user does everytime, having some additional
clue why an API failed could improve our bug detection workflow.
Change-Id: I364324ad5a8529b5363be3a7c6dc03ca52eb637c
With x64 Python on x64 OS, when the `sysnative` parameter
is set to False, return the SysWOW64 path instead of System32.
Change-Id: I72aaff5ff7719526227368a7b3d73ba177ed56fe
Previously it was using 14, for some compatibility with Windows NT.
We don't support Windows NT and the oldest version that we are supporting,
Windows 2003, supports passwords much larger than 14 characters.
Change-Id: Ifebb2ef8cee7eea76de4853bfd7399be97a95be3
The patch adds `get_maximum_password_length` to osutils. The Windows
specific value which was used in setuserpassword and createuser plugins
is moved in the Windows implementation of get_maximum_password_length.
Change-Id: I08f999c750ac7e2858493072d41bb8f4927521ca
Since the sethostname plugin was moved in plugins.common, there was a bit
of Windows specific functionality inside it, the fact that it returns reboot_required
in order to set the hostname on Windows. Now this choice is moved to
osutils.set_host_name, which will simply return False for non-Windows systems.
Change-Id: Ic7774f2c7dd86f3ade82a19520df4301bc9674a7
This patch unpacks all the ips received as the NTP data from
the DHCP options and passes them properly to w32tm.
Change-Id: I19f0f8dfe040e983a04abe4744387adcbd9d0bdd
Closes-Bug: #1411006
This patch always changes the trigger mode of w32time service to
network availability mode, even if it was already set on domain joined
triggers. Even if the service was set to start automatically, if the
triggers weren't fulfilled, the service would have stopped after a while.
Change-Id: I4dea740e970fa71eb5af4fab784321d08ae10bbf
Closes-Bug: #1408983
Replaces the Windows user creation and password management
implementation from "NET USER" execution to ADSI COM usage.
Change-Id: I4f95b094c95abb11762943afdb4be26541493159
Closes-Bug: #1404533
Using keyword arguments makes the intent of the code clearer, due to
the fact that a name is attached to a boolean value, making the
reasoning about the code easier.
Change-Id: I0dd05fa521ed8bbaf1c6dbd7a3e554384642c1f4
The networkconfig plugin can now handle custom NetworkDetails
objects that contain data like IP address, gateway, broadcast etc.
Change-Id: Ife3f8f62b47704e7f25e0304b15953d6f06e8620
Replaces WMI queries to obtain DHCP client configuration with Win32 calls
in order to execute plugins that require DHCP options in the Specialize
pass after Sysprep.
The "PhysicalAdapter" property of the WMI class "Win32_NetworkAdapter"
has been introduced with Windows Vista / 2008.
This patch avoids using the property in WQL queries based on
the current os.