| Age | Commit message (Collapse) | Author | Files | Lines |
|
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.
|
|
Henrik brought up that with the new restrict_environment_manifest
setting set true, authors of modules in a particular environment
may be surprised by a manifest they have specified in their
environment.conf not being pulled in, leading to bad behavior when a
catalog is executed. Although this is logged on the master, compilation
delivery and catalog execution is not prevented.
This commit will raise an exception on the master prior to catalog
compilation if it detect's a conflict between manifest settings in the
requested environment.
|
|
This fixes environment equality to make it work as a hash key. It also
adds tests around this functionality.
|
|
Conflicts:
spec/unit/face/module/install_spec.rb
spec/unit/face/module/list_spec.rb
spec/unit/face/module/uninstall_spec.rb
spec/unit/module_tool/applications/installer_spec.rb
spec/unit/module_tool/applications/uninstaller_spec.rb
spec/unit/module_tool_spec.rb
|
|
* 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
|
|
In master, hyphenated module names are supported (effectively)
everywhere except as the name of a dependency. A previous commit in this
branch attempted to alleviate that situation, but failed to adequately
test the change and its implications, and potential failures existed.
This change introduces a change to existing tests that triggers the
offensive behavior both in master and in this branch, and refactors the
implementation to apply the necessary transliteration in all required
locations.
|
|
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
|
|
When reading EnvironmentConf settings, relative paths were prepended
with the directory environment path. This commit ensures that we also
expand the paths properly so that they are absolute on both Windows and
Posix platforms.
|
|
Legacy environments could have config_version set in their puppet.conf
stanza, just as any setting in an [env] stanza would shadow if that
setting was looked up in the context of the environment. But the new
directory environments are intended to explicitly include config_version
as a setting (albeit an optional one).
This change adds a config_version attribute to
Puppet::Node::Environment, looking it up from settings if a new call is
made, or taking it directly from a create call, which is what the Directory
environments loader will do once environment.conf is parsed for
directory environments.
|
|
Puppet::Node::Environment.current is used in some external code, so
reimplement it, linking to the context lookup for the current environment
and issue a deprecation warning.
|
|
Modulepath was already being expanded; this ensures manifest is expanded
as well and fixes some specs so that they will work on Windows too.
|
|
Previously, whenever the known_resource_types
(Puppet::Resource::TypeCollection) was retrieved from the
environment it would check if there were any files that needed to be
reparsed. If any files needed a reparse, then the entire TypeCollection
was thrown away and redone.
In most cases the reparse check did not need to touch the filesystem
because the Puppet::Util::PeriodicWatcher would return a cached result
until the filetimeout had expired. Unfortunately the check was done so
often that the overhead of simply checking if enough time had passed
caused it to take a considerable amount of time.
This changes it so that the environment's known resource types are only
recalculated if the new check_for_reparse method determines that it
should. The new method is only called at the beginning of a compile and
so the files will never be checked while a compilation is being
executed.
In my local benchmark runs (the many_modules benchmark) this resulted in
a speedup from ~0.8 seconds to ~0.6 seconds.
|
|
Both `puppet apply` and `puppet parser validate` were relying on the
legacy environment behavior to implicit draw in the setting of
Puppet[:manifest]. But the new directory environments do not pay
attention to Puppet[:manifest] and thus a call such as `puppet apply
foo.pp --environment dir_env` would not apply foo.pp if dir_env was in
the $environmentpath.
This change explicitly creates a new environment based off the currently
configured environment and overrides with the manifest this to be
applied or validated.
|
|
Instead of creating environments directly, we need to go through the
configured environment loaders, otherwise environments can't come from
other places.
|
|
Environments are more than just a name, they are also a modulepath and a
manifest. This commit makes a "create" method for setting up
environments with specific modulepaths and manifests rather than relying
on the Puppet Settings at the time that methods are called. In order to
control environments for module installation they now take advantage of
this in order to control the modulepath that things will be installed
into.
|
|
After trying to get the manifest and modulepath during the
initialization for an environment, it turned out that a lot of other
things depended on a very specific load order. Some of those needed to
change around, others needed to delay executing until later, after
everything had been loaded and initialized (creation of the root
environment was one of these). The reset of the Parser::Functions also
moved so that it doesn't happen until settings have been initialized.
|
|
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.
|
|
|
|
Instead of passing known_resource_types, if present, pass the given
environment, and provide a delegate method to watch_file on Environment.
Clears up a few layers of type checking and does not require the adapter
to know anything about known_resource_types for the purpose of watching
files, but a valid environment must be passed.
|
|
* pr/2158:
(Maint) Fix deprecation message to point to the right alternative
(#23373) Only parse section lines once
(#23373) Restore 'all' functionality
(Maint) Remove unused code
(#23373) Don't apply all metadata
(#23373) Use puppet config set in tests
(#23373) Don't set metadata when it isn't supported
(#23373) Check for minimal use of [main]
(#23373) Reuse existing section headers
(#23373) Add section control to the config print action
(#23373) Pull apart settings into a few more classes
(#23373) Provide a more structure config file parse
(#23373) Have config parsing use IniFile's sections
(#23373) Support selecting the section
Closes GH-2158
|
|
This adds the ability to run a directory of manifests instead
of just a single file. Simply assign a directory to Puppet[:manifest]
via settings or from the command line.
The files are parsed and combined in alphabetical order as if the
files were to be concatenated into a single file.
The support is in environment, and it is only support for the
initial import. This also means that both current and future parser
can be used (i.e. the support for this is not in the parser).
Testing is done in integration/node/environment_spec.
|
|
The monolithic settings infrastructure is really hard to work with. In
order to implement the functionality for puppet config print to reliably
be able to print the value of any given section of the configuration I
need to be able to split it apart from the very static structure that
exists inside puppet. This takes a step in that direction by starting
the process of extracting the lookup logic into smaller classes.
|
|
- All previous File and FileTest calls to exist? or exists? go through
the new FileSystem::File abstraction so that the implementation can
later be swapped for a Windows specific one to support symlinks
|
|
|
|
This renames validate_as_json methods to be specific to the schema they are
validating (since that's embedded in each definition) and inlines the
implementations that didn't need to be abstracted.
|
|
* upstream/stable:
(maint) Move constant outside shared_examples_for to avoid "already initialized" warning
(maint) Windows failing spec fixes
Conflicts:
spec/unit/node/environment_spec.rb
|
|
|
|
|
|
|
|
|
|
- The usage of Dir.getwd in tests has been simplified to
File.expand_path to properly handle mixed case CWD
- util_spec.rb ensures 'FOO' Env var cleared before test starts
- Windows SID checks should be performed as a regex match to
properly handle all accounts starting with S-1-5-*, which denotes
accounts with an identifier authority of SECURITY_NT_AUTHORITY
instead of hardcoding S-1-5-32-544, the Administrators group
|
|
Puppet does not support running in any threaded environments. The thread
safety code that has been added has been, for the most part, haphazard
and not a holistic solution to the threading problem. There are many
areas that are not protected at all and others that were protected in
incomplete ways. The extra code and logic only caused more complication
in the codebase and is removed by this commit.
|
|
A lot of blank lines had picked up extra spaces.
|
|
Change all instances of the `:_timestamp` fact to `_timestamp`. Symbols can be
converted to strings during a round-trip through a simple terminus such as
JSON. If the Fact is then updated using the symbol, there will be two names for
the same data.
After 5ac681f, in the 3.0 rc series, all varible names are explicitly
stringified when added to compiler scopes. This means that facts named
`:_timestamp` and `_timestamp` will end up mapping to the same scope variable
which violates static single assignment.
|
|
|
|
|
|
Fact stringifying is on by default, but we're issuing a deprecation
warning on stringified facts. Since it looks like we'll have to
stringify facts for a while, this commit removes the deprecation
warning.
This is an update of GH-1658 that takes the comments into account.
|
|
Add the option stringify_facts which defaults to true. If it is turned
on the current behaviour with turning facts into strings is kept.
If it is false facts are sanitized and only converted to strings if they
aren't booleans, numerics, arrays and hashes. It does this sanitizing in
a nested manner for arrays and hashes.
|
|
Tests were hardwired to run for only future/eparser. Now all tests
where parser is involved runs for both current/classic and
future/eparser (except when testing methods; where parsing is only
done in order to construct a call; it is the function that is tested,
not the parsing). The collect method testing includes testing the
various ways a call can be made to it, but this is the only place; this
because it is more work to unwire all the others when the final style
for lambdas gets picked.
|
|
This separates the PopsParserAdapter from the ParserFactory and
renames it to EParserAdapter.
|
|
|
|
This reverts commit 7bd6a908a82b0502558564d32a7fa604cee3c5a3, reversing
changes made to 480379d1f61d88e732bd10d6773845a788351ed3.
This commit seems to be the cause of acceptance test failures so I'm
backing this out until we get that cleared up.
|
|
When changing settings or initializing Puppet via TestHelper, the
Puppet::Node::Environment.clear method is called to delete the cached
environment objects, as they may reference cached module paths based on old
values of settings.
The *root* environment is a special case, as it acts as the current environment
when no other environment has been created and set yet. It can still have a
module path based on current settings, so it too should be cleared along with
other cached environments.
Failure to reinitialize *root* causes failures when initializing Puppet via the
TestHelper. The Puppet::MetaType::Manager class uses the current environment
in calls to Puppet::Util::Autoload, which starts as the default *root*
enviroment. The type loader is called a few times during TestHelper
initialization and so if the module path is then changed (which triggers a
.clear call), the *root* environment will contain paths based on old settings,
so types won't load.
Loading types based on the environment is new in 8173a6e6 (2.7.19). 3.x is
unaffected as caching of module paths doesn't begin until
app_defaults_initialized? changes to true.
|
|
This reverts commit 751efa9174adfe1bc0a5707855e6ba16ff2aed43, reversing
changes made to 023cffdbb9b30945fbf4dcaded4f63428ce54ea7.
Conflicts:
lib/puppet/dsl/context.rb
spec/unit/dsl/context_spec.rb
|
|
This adds new Ruby DSL features by Mateusz Lenik.
This was developed as a Google Summer of Code project.
This commit contains all of the new Ruby DSL work in one single commit.
|
|
Without this patch Ruby 1.9 is still complaining loudly about trying to
parse the spec files. The previous attempt to clean up this problem in
edc3ddf works for Ruby 1.8 but not 1.9.
I'd prefer to remove the shebang lines entirely, but doing so will cause
encoding errors in Ruby 1.9. This patch strives for a happy middle
ground of convincing Ruby it is actually working with Ruby while not
confusing it to think it should exec() to rspec.
This patch is the result of the following command run against the source
tree:
find spec -type f -print0 | \
xargs -0 perl -pl -i -e 's,^\#\!\s?/(.*)rspec,\#! /usr/bin/env ruby,'
|
|
The environment set by set_local_facts was not always correct. Since the node
object should always have the correct environment now we should just use that.
|
|
Remove `downcasefact` and `downcase_if_necessary` as downcasing
of facts is no longer supported.
|
|
* 2.7.x:
Add Puppet::Parser::Functions::clear for specs
Clear Environment.current when calling Environment.clear
Check that function loading worked correctly.
Avoid stubbing Thread::new due to issues in newer mocha
Rename specs to end in _spec.rb
Don't require mocha in spec_helper
Fix stubbing on nil in some specs
(#14515) Tests fail with mocha 0.11.4
Conflicts:
spec/unit/network/http/webrick_spec.rb
spec/unit/parser/functions/require_spec.rb
spec/unit/parser/functions/template_spec.rb
|
|
This makes Puppet::Node::Environment::clear properly clear all the environment
state. This reduces dependencies between tests due to leaked state. It also
moves the call to clear to happen before each test. This avoids issues where
tests set up stubs on settings, as the after block is called before stubs are
removed.
|