Age | Commit message (Collapse) | Author | Files | Lines |
|
- Move Windows ADSI code out of puppet/util and into
puppet/util/windows
- Update namespace from Puppet::Util::ADSI to
Puppet::Util::Windows::ADSI
- Add module / class definitions for ADSI to util/windows.rb
to prevent tests from blowing up on non-Windows
- Moving Puppet.features.microsoft_windows? checks to top of
user and group provider tests for ADSI
- Update all dependent code, remove unnecessary references
|
|
- LogonUserW, LoadUserProfile, UnloadUserProfile and PROFILEINFO
have been converted from manually packing params with Win32API.new to
automatically managed with FFI definitions.
- Use MemoryPointer where appropriate.
- Note that wide character LogonUserW is used rather than platform
varying LogonUser as FFI is unable to use that. The pointer
widths of PROFILEINFO vary depending on platform, which is handled
by using :pointer. With LogonUserW the string pointed to is always
wide character, which is properly handled by using wide_string.
- Add FFI::MemoryPointer helper read_handle
- Add FFI::MemoryPointer.from_wide_string and corresponding tests that
ensure that a properly terminated UTF-16LE string is passed in
- Add FFI::MemoryPointer#read_wide_string that reads a wide string buffer
into a Ruby string with Encoding.default_external and corresponding tests
- Add additional tests around User methods that make native Win32 API calls
that will intentionally fail
- Fix wide_string helper to return nil when given nil so that can be passed
directly to Win32 as a null pointer
|
|
|
|
Earlier, we’d added a ‘mode’ parameter to the P::U::Execution.execpipe
to support writing to the subprocess’ STDIN. This commit removes that
functionality since we do not depend on it, we’ve never published it in
a supported release, and we do not wish to provide ongoing support for
it.
|
|
Fixes some rdoc1 spec issues by providing explicit envs in the specs.
|
|
A few specs relying on mocking Puppet::Node::Environment.new to return
a specific test environment were colliding with the new environments
cacheing layer. Switched to using puppet override to supply a static
environment.
|
|
* pr/2477:
(PUP-2073) fix for multiple diff_args
Closes GH-2477
|
|
Previously, if you specified multiple arguments in the `diff_args`
setting, they would be considered a single argument and quoted to the
diff command. Puppet would then try to execute:
diff '-u --strip-trailing-cr' pathA pathB
But would silently fail without showing any diffs.
This commit ensures we can handle multiple diff args.
|
|
pvande/bug/master/pup2278_fix_pmt_handling_of_paths_with_spaces
Accept paths with spaces in PMT tarball interactions.
|
|
In the previous commit, the default behavior of `execpipe` was changed
to ensure that the pipe was always opened in read/write mode. While we
aren't aware of any regressions this change would cause, the cautious
route is to maintain the same default behavior for now; to that end,
this commit adds a `mode` parameter to `execpipe`, allowing callers to
choose the mode the pipe is opened in.
|
|
Prior to this commit, if the module_working_dir or the path to a module
being built contained whitespace, our simple string-interpolation
would fail to create a valid call to `tar` or `gzip`. This change fixes
the bugs resulting from that behavior.
|
|
Puppet::Util::Logging#deprecation_warning keeps track of issued
deprecations keyed by the originating code line. This works reasonably
well for tracing API deprecations, but can cause a problem for
notifications coming from internal calls which might happen to be called
multiple times by other code sections. It also causes problems if the
same line of code issues different deprecation warnings (say by
interpolating some parameter into the message).
This patch allows an optional key string to be submitted with the
deprecation_warning which takes precedence over using the
originating call line as the key.
|
|
* stable:
(packaging) Update PUPPETVERSION to 3.5.1-rc1
(maint) Raise error when parsing duplicate INI section
(maint) Yumrepo boolean values are case insensitive.
(PUP-2178) Map INI name to yumrepo descr
(PUP-2181) Delete ini file entries on absent property
(PUP-2179) Replace Puppet::Util::IniConfig::File
(PUP-2179) Implement simple INI file collection
(PUP-2179) implement storing for single INI files
(PUP-2179) Implement INI single file formatting
(PUP-2179) Extract standalone INI file class
(PUP-2179) Add test coverage for IniConfig::Section
(maint) Don't strip whitespace from yumrepo keys
(PUP-2162) support yumrepo baseurl/gpgkey multiple values
(PUP-2150) allow yumrepo params to be set absent
(PUP-2613) Comprehensively test all yumrepo params
|
|
PUP-2163 Smite yumrepo and inifile with the mighty sword of refactoring
|
|
|
|
This commit reimplements the Puppet::Util::IniConfig::File interface on
top of PhysicalFile objects. This makes for a much simpler and cleaner
implemenatation that we can swap out the implementation of the File
class.
|
|
|
|
|
|
The existing Puppet::util::IniConfig::File class is responsible for both
managing a collection of files as well as parsing, formatting, and
storing those files. This overloads the responsibility of this class and
makes it hard to make behavior changes.
This commit extracts a class that represents a single file. Since the
'File' constant is already used this is named 'PhysicalFile' in contrast
to the logical nature of the existing File class. This commit only
extracts the parsing and later commits will add more behavior.
|
|
|
|
* upstream/stable:
(PUP-2158) Unlist configured environment
(PUP-2158) Test dynamic environments with an empty environmentpath
(PUP-2158) Fix integration apply application spec
(PUP-2129) Fix issues with false interpolation start (no-such-method)
(PUP-2158) Report 404 for missing environment
(PUP-2158) Default a missing manifest to no_manifest
(PUP-2158) Hide dir envs behind a feature flag
Conflicts:
lib/puppet/node/environment.rb
spec/unit/environments_spec.rb
|
|
The tests were often creating environments that didn't need to have
manifests. Since we didn't have a way of specifying that when they
were written, we used '' to fill in the blank. This actually caused a
large number of tests to try to find code to load in the PWD, which
caused tests to break if a developer had parse errors in manifests being
used for testing in the root directory of their puppet project. This
changes the manifest to be optional and removes '' from those tests. The
tests no longer fail if a bad manifest is in the PWD :D
|
|
jpartlow/feature/master/pup-1433-deprecate-implicit-environment-settings
Feature/master/pup 1433 deprecate implicit environment settings
|
|
Sometimes the location that immediately triggered the deprecation
warning isn't enough information to understand what happened. This adds
the ability to see the full trace to the deprecation when --trace is
enabled.
|
|
|
|
Without this patch applied, Puppet doesn't know how to perform
checksums of files using the SHA-256 algorithm. This precludes Puppet
from being useful on hosts configured for compliance with U.S. Federal
Information Processing Standard (FIPS) 140-2.
The SHA-2 family of algorithms is recommended for use by the
U.S. National Institute of Standards and Technology (NIST) in FIPS
140-2; SHA-256 is the algorithm from this family having the shortest
output.
This patch makes SHA-256 available for use as a checksum algorithm by
other parts of Puppet, alongside MD5 and SHA-1.
|
|
Installing gems during a Puppet run should be picked up by features using the
'libs' option. However gems are installed into separate directories, so
rubygems maintains an in-memory directory cache, which needs invalidating
when attempting to load a library after installation.
|
|
One-liner handling wasn't behaving as expected. Sometimes one-liners are
buffered with extra newlines before and/or after, and in these cases, scrub
wasn't catching the leading whitespace.
This commit makes it behave as intended, and adds a test showing the intended
behavior.
|
|
This is because these methods are also used for deserialization from
other formats than PSON. The method for serializing a object is called
to_data_hash, so makes sense to call this from_data_hash.
|
|
- Previously, calling Puppet::Util::ADSI::Group.exists? for a
well-known group SID would return false, because the WinNT:// style
URI used to find the group would not examine / lookup the SID, but
would instead create a broken Uri that the underlying OS could not
understand
- Now, the given group name is checked to see if it's a SID before the
Uri is constructed, and a SID style Uri is created where appropriate
Paired-with: Joshua Partlow <jpartlow@puppetlabs.com>
|
|
PuppetParserCore was updated to pass environment, known_resource_types;
this just catches up the spec, which runs only on 1.8.7, to match the
changes.
|
|
Instead of creating environments directly, we need to go through the
configured environment loaders, otherwise environments can't come from
other places.
|
|
* ticket/master/PUP-1494/remove-native-ruby-encode-UTF-16-windows:
PUP-1494 Guard against Win32 memory corruption
PUP-1494 - Remove Windows iconv from colors.rb
|
|
- Ruby's .encode(UTF-16LE) call on String may generate a string that
not properly terminated with 2 NULLs, which may result in garbage
bytes read from the memory pointer passed into the Win32 API. This
can cause memory instability which results in failures in later
Win32 calls. These calls have been replaced with an internal
helper that properly NULl terminates the string. Note that this
bug is fixed in Ruby 2.1:
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=41920&view=revision
- Don't include the wide NULL character when calculating number of
characters to write to the console to properly indent Puppets stdout
output (without the -1 calculation, it's indented with two spaces).
- Includes a test to ensure that we can detect when `string_encode` is
updated in the future, when we move to a version of Ruby where the
String#encode bug is fixed for encodings with multi-byte terminators
Paired-with Josh Cooper <josh@puppetlabs.com>
|
|
This changes the loader used by the code to list environments to be a
composition of the legacy environments and the new directory
environments.
|
|
* upstream/stable:
(maint) Fix rdoc generator for Ruby 2.1.0
(maint) Fix a comment.
(maint) Fix can't modify frozen Symbol error on Ruby 2.1.0
(PUP-1389) Embed the extra NULL within the string
(PUP-1389) Simplify logic for appending extra NULL
(PUP-1389) ReplaceFile to FFI / move wide_string
(PUP-1389) Ensure wide strings have double null terminators
PUP-1322 Do not fail hard on unparseable files
(maint) Correct documentation of each function
(maint) Fix acceptance test for scheduled_task deletion
Conflicts:
lib/puppet/parser/functions/each.rb
|
|
This reverts commit cf4501c7a97c106994c2ef81756c2081f56feeef, reversing
changes made to fcf482aa85708fe20f38cd96d6d92fc58ee78cf6.
|
|
Previously, we were appending a NULL to the wide encoded string to work around
a ruby bug fixed in 2.1.
However, we were calling `String#strip`, which makes a copy of the string, and
in the process only preserves the first NULL.
This commit embeds a NULL within the string itself, e.g. "bob\0". Since the
NULL is part of the string data, ruby will preserve it.
Also, `String#+` cannot combine strings with different encodings,
e.g. "a".encode('UTF-16LE') + "\0" results in:
incompatible character encodings: UTF-16LE and US-ASCII
which is why we need to encode the terminator. The actual message depends on
the default encoding, e.g. US-ASCII, UTF-8.
|
|
|
|
* pr/2168:
(PUP-1150) Fix race condition in Puppet::Util::Lockfile.
This closes GH-2168.
|
|
Before this commit, Puppet::Util::Lockfile.lock called the locked?
method before opening the @lockfile for write. Checking that the file
doesn't exist and creating the file were not an atomic operation, which
allowed two processes to detect that the file didn't exist and open it
for write simultaneously.
This commit adds and used Puppet::FileSystem::exclusive_create wrapper
that sets the following options:
* File:CREAT - Creates the file if it doesn't exist.
* File:EXCL - Fails if the file does exist.
* File:WRONLY - Opens the file for write only.
File:EXCL is the important option, callers will recieve an Exception if
the file exists, meaning another process has acquired the lock. If the
file doesn't exist it will be created atomically, so other another
caller cannot create the file in the gap.
|
|
* pr/2261:
(PUP-1389) Simplify logic for appending extra NULL
(PUP-1389) ReplaceFile to FFI / move wide_string
(PUP-1389) Ensure wide strings have double null terminators
|
|
- Previously, Puppet would ignore the configuration in defaults.rb for
setting a group / owner on a given file or directory -- even when
the Windows machine was running with administrative permissions
- Since Windows now has the capability of properly setting a group
and owner, allow Windows to manage these permissions when
appropriate
- The existing Puppet::Settings::FileSettings::Service class
depends on looking up the appropriate default service accounts
for use in a number of locations. To fall in line with this usage
pattern, "Administrators" is set as the default owner and
the "Service" group S-1-5-6 is set as the default group. This
special OS managed group includes all accounts with the logon
as a service token privilege.
|
|
- Previously, calling Puppet::Util::ADSI::Group.exists? for a
well-known group SID would return false, because the WinNT:// style
URI used to find the group would not examine / lookup the SID, but
would instead create a broken Uri that the underlying OS could not
understand
- Now, the given group name is checked to see if it's a SID before the
Uri is constructed, and a SID style Uri is created where appropriate
|
|
Puppet::Util::Windows::File.replace_file now calls FFI to
replace files in place on Windows.
Puppet::Util::Windows::File.wide_string has now been moved to
Puppet::Util::Windows::String.wide_string.
This moves wide_string to lib/puppet/ubilt/windows/string.rb,
adds specs concerning different encodings.
In addition, we've removed Windows::API::WideString usages from
everywhere it was found as it is known to cause issues with Windows 2012.
Puppet::Util::Windows::Process.lookup_privilege_value in particular was
changed to use LookupPrivilegeValueA (ANSI) as we control the privilege name
being passed to it.
Paired with Josh Cooper <josh@puppetlabs.com>
|
|
This adds a new matcher to the JSONMatchers to validate json against a
given json-schema. All of the json schema validation now goes through
this one matcher, which also handles skipping the checks on windows.
|
|
|
|
|
|
Ruby uses ANSI versions of Win32 APIs to read values from the registry. The
encoding of these strings depends on the active code page. However, ruby
incorrectly sets the string encoding to US-ASCII.[1]
As a result, if you try to perform a regex match on the string, and the string
contains the registered trademark symbol, 0xAE, then ruby will raise an error
saying 'Invalid byte sequence in US-ASCII'
This commit forces the encoding of REG_SZ, REG_EXPAND_SZ, and REG_MULTI_SZ to
the encoding for the active code page. So if the active code page is 1252, the
ruby encoding will be `Encoding::CP1252`.
See https://bugs.ruby-lang.org/issues/8943
|
|
|