Age | Commit message (Collapse) | Author | Files | Lines |
|
The :undef symbol was still leaking all over the place internally. This
caused type inference to sometimes end up with Runtime[ruby, Symbol]. By
using nil instead of :undef, everything can be much more
straightforward. Once the code removal for puppet 4 comes into play even
more oddities around how resource parameters are handled can be
performed.
|
|
ffrank/ticket/3.7.x/PUP-3357-purge-unnamed-ssh-keys
(PUP-3357) purge unnamed ssh keys
|
|
Add an integration test with an ssh keyfile in which two keys have no name
and make sure that both are successfully purged.
|
|
For PUP-2857 :undef was changed from being a PNilType to a PRuntimeType.
This stopped the undef literal in the language from being able to be
assigned to Optional parameters. However, this only happened when the
undef was the default expression for the parameter.
|
|
The tests had their own way of creating files and directories for
testing. All of these different ways of creating files and directories
already existed in PuppetSpec::Files. This unifies them.
|
|
|
|
Nodes can be classified through a local executable that prints YAML with
a node specification. This is enabled through the node_terminus=exec option.
Since PUP-2519, this setting would break `puppet apply`. Trying to apply
any manifest would lead to Puppet applying the default environment's site
manifest instead.
The reason for this is that the node terminus will include the current
environment's name in the node lookup result. This in turn makes Puppet
look up the environment per name. This is not the desired behavior, because
Application::Apply performs the lookup and further operations with a localized
environment that overrides the site manifest.
Solved by including the current environment object in the returned node object
instead of its name.
|
|
Previously the test failed on windows, because we were expecting the
environment config_version to return on POSIX path. But on Windows it is
expanded based on the current drive.
Paired-with: Josh Partlow <joshua.partlow@puppetlabs.com>
|
|
jpartlow/issue/stable/pup-3162-whitelist-environment-interpolation
(PUP-3162) Issue/stable/pup 3162 whitelist environment interpolation
|
|
Previously, the windows security_spec could fail if the same test was
executed in parallel, since the test assumed the account didn't exist.
This commit makes the names unique. The maximum length for local
user and groups accounts in 2003 is 20 and 256 characters[1],
respectively, and we remain below that limit in both cases.
[1] http://technet.microsoft.com/en-us/library/cc783323.aspx
|
|
Previously, the windows service provider rescued exceptions of type
Win32::Service::Error. However, FFI-based versions of win32-service (v0.8.x)
no longer raise that type of error. Instead they raise SystemCallError.
So previously, if puppet failed to manage a service, e.g. service didn't
exist, puppet would try to rescue the exception specifying a class that
was not defined:
puppet resource service foo ensure=stopped
Error: /Service[foo]: Could not evaluate: uninitialized constant Win32::Service::Error
This regression was introduced as part of PUP-1283 when we migrated from
win32-service version 0.7.x to 0.8.x.
This commit modifies the various provider methods to more broadly rescue
StandardErrors and updates the spec tests to handle the negative cases.
Paired-with: Ethan J Brown <ethan@puppetlabs.com>
|
|
Previous commit blacklisted a small set of settings from having
$environment interpolated. After some discussion, we decided to broaden
this to a whitelist, and the only setting we can currently think of
needing $environment interpolation when using directory environments is
config_version.
We also decided to not halt startup for default_manifest with
$environment in it, as these errors are difficult to read with the
current error reporting from a rack master. So the validation for
default_manifest is removed.
|
|
There are a few settings for which interpolation of $environment does
not make sense when using directory environments.
* default_manifest -> defines either the relative path to manifests
within a directory environment, or an absolute path to manifests to be
used by all directory environments. It is currently a configuration
error to set $environment within default_manifest.
* basemodulepath -> conceptually, this is intended for supplemental
modules required for all environments, and should not vary by
environment.
* environmentpath -> this is the base path defining what directory
environments can be found. Interpolating $environment within it makes no
sense.
Additionally, both environmentpath and basemodulepath are required by
the environment loaders during initialization. They will interpolate
relative to a specified environment if you interogate config, but in a
running master instance, will have interpolated to the default
environment regardless of the current environment being processed for a
catalog, for instance.
A last case, irregardless of type of environment, is the pathological
case of attempting to interpolate $environment within environment.
This, unsurprisingly, causes a stack overflow.
This patch adjusts the Puppet::Settings interpolation code so that
$environment is not interpolated within any of these four settings when
using directory environments (so, when the environmentpath has been
set).* So assuming a confdir=/etc/puppet,
basemodulepath=$confdir/modules/$environment will be interpolated as
'/etc/puppet/modules/$environment' and a warning will be logged.
*Currently setting $environment in default_manifest will error out
when puppet loads as a setting validation error, and this behavior will
never be reached.
|
|
|
|
Add module namespacing to two specs declaring an FS constant (for
convenience) so that we don't receive warnings about the duplicate
declaration.
|
|
jpartlow/feature/master/pup-3069-add-defaultmanifest
Feature/master/pup 3069 add defaultmanifest
|
|
Previously the environments/default_manifest_spec.rb was only running
with the current parser. This runs the set of tests for both the future
and current parser cases.
|
|
hlindberg/PUP-3117_resource-expression-splat-rocket-alt
(PUP-3117) Complete the Resource Expression implementation
|
|
After discussion with Nick Fagerlund and Henrik Lindberg, changing
restrict_environment_manifest setting to
disable_per_environment_manifest to more clearly reflect what the
setting does.
|
|
This adds integration testing of the new default_manifest and
restrict_environment_manifest settings. It tests all the way from
Puppet initialization from actual puppet.conf files and
environment/manifest files through catalog compilation, simulating
Puppet master activity. Since these settings are purely server-side
constructs, in that they do not impact the agent beyond the contents of
the final catalog the agent receives, I believe this is sufficient to
validate them.
|
|
Added tests for checking that default_manifest behaves properly when
given $environment. Also when restrict_environment_manifest is true with
a non-relative default_manifest.
This commit also fixed the hook on the :default_manifest setting to
validate that $environment was not present when setting the value.
|
|
This completes the implenentation of the Resource Expression.
* The LHS must now be a QualifiedName (i.e. file, notify), or
a QualifiedReference (i.e. File, Notify), or an access expression
with a left QualifiedReference (i.e. Resource[file]), or literal
'class'
* The result of the LHS must be a CatalogEntry type, and it may not
be detailed to title level.
* The * => syntax can be used to to unfold a hash. It may be used
once per titled resource body. Attribute names must be unique across
the attributes set with name => expr, and those set with * => hash.
|
|
snippets
In the puppet 4.0 parser, the file resource's mode property will be
required to be a string containing an octal (or symbolic) representation
of mode.
For consistency then, this commit changes all cases where mode was
specified as a Numeric to be a string containing an octal representation
of mode (always prefaced with a 0, again for clarity and consistency).
|
|
|
|
This fixes a problem in the grammar that made it impossible to have
more than one *=> per body.
This commit also adds a check for duplicate entries in the resulting
hash with the final set of parameter to value mapping.
|
|
- win32-eventlog gem upgraded from 0.5.3 to 0.6.1 as part of
https://github.com/puppetlabs/puppet/commit/ac8d4e257f69beaf87489b2e2a57f8aaab512edc
- win32-eventlog gem 0.6.1 doesn't yet include the patch necessary to
properly load it on 2003 from:
https://github.com/djberg96/win32-eventlog/commit/4692e2a67ae8dc794981928d6e6488b775a6689a
- Therefore, mark these eventlog tests as pending on 2003 until the
0.6.2 gem ships and the Gemfile can be updated
- These guards will be removed as part of PUP-3061
|
|
It is now possible by checking if the result of a "produce" had
no effect on the catalog by comparing against an empty array.
|
|
This changes the tests of the puppet language, which should become part
of the language specification's example and test suite, to be entirely
expressed in the puppet language. This removes any dependency on ruby!
Well, any dependency on ruby for specifying the language tests.
|
|
PUP-121 was supposed to make all references to classes and resource
types absolute, but it looks like it missed a spot. The class referenced
in an inherits clause was not being looked up in an absolute manner,
which caused it to find the wrong parent class in certain cases. This
changes the future parser so that inherited classes are always absolute
names.
|
|
The resource_expressions_spec contained a useful way of writing language
specification tests. This extracts those out so that they can be reused
in other places.
|
|
The comment had trailing whitespace and a comma. It makes more sense
without either.
|
|
ticket/master/pup 2907
|
|
(PUP-2972) Remove += and -=
|
|
The previous error message was very abrupt and didn't provide any kind
of guidance for the user. The new message for += and -= let's them know
that it is *no longer* supported and has a link to where they can get
more information.
|
|
Previously the future parser supported += and -=. += was very similar to
the same operator that is in the current parser, but with a few
differences to make it consistent with the rest of the
language. The += operator no longer performed string concatenation and
instead acted like $a = $a + $b. The -= operator was added to complete
the set of operators available.
However, many people have been confused by these operators (even as they
exist in the current parser):
* It looks like mutation, but the language does not have mutation
* It looks like += from other languages, but doesn't behave like them
* Shadowing a variable is something that needs to be explicit,
otherwise it becomes confusing.
This removes += and -= from the future parser. They are still parsed,
but the validation step will issue errors if they are encountered.
|
|
This reverts the change in PUP-867 by (again) calling the same 3x logic
for looking up defaults. The implementation of PUP-867 also added tests,
and one of those are now changed to reflect the changed behavior.
|
|
In Ruby commit 2142287c `FileUtils.compare_stream` was optimized to
produce fewer objects while comparing streams by predeclaring a pair of
strings and reusing them for each iteration of the comparison. However,
this change exposes some inconsistency in how ruby handles IO#read vs
StringIO#read. When IO#read is passed a length and string, it will copy
the read data into the string, but will convert the encoding from the
expected ASCII-8BIT into the encoding of the string regardless of if the
file was opened as a binary file. However, when StringIO#read is passed
a length and string it will convert the passed string to the expected
ASCII-8BIT. Because of this it's impossible to use `FileUtils.compare_stream`
to compare a binary file and StringIO instance.
To resolve this issue, this commit adds a custom compare_stream method
which sets the encoding of the strings to always be ASCII-8BIT on Ruby
1.9+.
|
|
Previously, the plugin_handler module was responsible for creating
downloaders and evaluating them. Since all of this happens within a
single method it is hard to test that the downloaders are created with
the correct set of properties. For example, we `ignore` source
permissions when downloading plugins, but we `use` source permissions
when downloading external facts, since those often contain scripts,
which must be executable.
This commit moves the logic for creating the downloaders to a factory
and updates the tests accordingly. As part of this change, the
PluginHandler module is changed to a class and is no longer mixed into
the Configurer.
|
|
This reverts commit 1a428b92c900e84d9faa5d0aaa1a32f3c0b1d42b, reversing
changes made to cb26e23706b76e44544c14f4c921885f17dccbb3.
|
|
This reverts commit 133c0b8009a48eef77d68c0bd8d5f79c930dab50.
|
|
|
|
|
|
FileUtils.compare_stream in Ruby 2 is broken when comparing
binary file stream with StringIO stream of different encoding.
This change reverts FileUtils.compare_stream to stdlib v1.9.3
implementation.
|
|
Ruby 1.8.7 doesn't allow trailing commas in parameter lists. This
problem was present in the resource_expressions_spec file and is removed
by this commit.
Ruby 1.8.7 doesn't have an empty? method for Symbol. This changes the
evaluator_impl to compare against the EMPTY_STRING constant instead,
which does work on 1.8 and 1.9.
|
|
This adds a combined example of most of the features being used
together: title expressions, type expressions, splatted parameters,
exported resource, and resource reference.
|
|
This adds checks for the specification's assertions that virutal and
exported resources are not in the produced catalog, but are available
for later operations (realization) and reference (reading a parameter
value). This cannot check that the exported resources are made available
to catalog processors, since that is implementation dependent.
In order to check this the compile_to_catalog method needed to be
changed to filter out expoerted resources, just like the catalog
indirection does. This required a change to the create_resources test.
|
|
When a title array is empty, there are no resources created.
|
|
Prior to this commit, empty string titles did not cause an error.
However according to the specifications, a string should have a
minimum length of one. With this commit, the parser will now
raise an issue when an empty string title is given.
|
|
The implementation for *=> looks to have been a copy-paste from the =>
implementation, however the expression attribute on AttributesOperation
is just `expr` and not `value_expr`.
|
|
This adds tests around the behavior of the current and the future
evaluator's resource instantiation expressions. There are many cases in
the current system where the tests are commented out because there isn't
any consistent behavior.
|