This commit adds the has_macosx_plist_overrides? method to determine whether we're on a version of OS X >= 10.6. Plist handling changed as of version 10.6, and this method allows us to implement different plist behavior without needing to modify code whenever Apple releases a new version of OS X (assuming plist behavior doesn't change).
Most versions of ActiveRecord, including the ones I test with, treat an interpolated symbol in an SQL query as a simple string, vis: ["example = ?", :banana] => "... WHERE example = 'banana' ..." Some versions, though, preserve the symbol-nature, and instead: ["example = ?", :banana] => "... WHERE example = ':banana' ..." # ...or some variant of that, where it isn't just the string. So, to avoid this confusion, manually stringify the symbol name of our resource type in the query builder. This gives consistent and expected behaviour at all times. Signed-off-by: Daniel Pittman <firstname.lastname@example.org>
We've flipped around the confine check so we explicitly exclude the versions of OS X where this provider won't work, rather than working from a whitelist.
When the StoreConfig system was extracted from core to a set of termini, most of the rules about permitted syntax were pushed down into the same place, to allow them to also be replaced. One set of restrictions were missed, the limitation that complex search criteria (like and, or, or parenthetical expressions) were not permitted, and remained in our parser. Now, they live in the terminus, and we enforce them only there. This ensures that StoreConfigs can be replaced with a back-end that supports complex collection criteria without other changes to the Puppet core. Signed-off-by: Daniel Pittman <email@example.com>
This error class is only defined when using the win32-process gem on Windows. So rather than always trying to rescue Process::Error (which of course causes its own error), we build a list of classes to rescue, which initially only contains Errno::ESRCH, and add Process::Error if it exists.
At this point it looks like the only remaining cause of the ActiveRecord failures could be that someone is leaking an active database handle in ActiveRecord from an unrelated test. The theory is that if the handle is open, SQLite will try to create a lock file in a directory that no longer exists during the test; this raises the I/O error we see here. To verify this, which can currently only be reproduced in the CI system, we close off any active handle before changing the database location settings. Signed-off-by: Daniel Pittman <firstname.lastname@example.org>
… reports." This reverts commit 74602e0. The change is incomplete, despite reading right, and shouldn't have been merged.
When writing reports, there is a window in between opening and writing to the report file when the report file exists as an empty file. This makes writing report processors a little annoying as they have to deal with this case. This patch writes the report into a temporary file then renames it to the report file, which eliminates this window.
In some cases turning StoreConfigs on, then off, can lead to test failures that do not reflect reality. Instead, avoid that by using rspec contexts to separate out the two phases nicely. Signed-off-by: Daniel Pittman <email@example.com>
The state preserving code had a single type, resulting in the wrong value getting saved and restored. This made the previous commit ineffective, and explains entirely why it didn't resolve the problem in the field. Signed-off-by: Daniel Pittman <firstname.lastname@example.org>
Signed-off-by: Daniel Pittman <email@example.com>
One of the most persistent and troublesome parts of the Puppet codebase, in terms of testing, is the indirector. It has significant global state in the terminus and cache configuration, and that state was not being preserved between tests. Given that the runtime performance cost of doing this, other than the very ugly code it engenders, is approximately zero (less than 0.5 percent runtime), and it substantially improves correctness of testing... Now we save and restore that state around every test. Signed-off-by: Daniel Pittman <firstname.lastname@example.org>
We had additional global state modifications out of my testing, where the cache class and terminus for indirections were changed. This caused, in some cases other than "running on my workstation", the tests to fail trying to use the wrong terminus. This fixes that, by resetting the state appropriately so we don't leak global configuration and break each other. Signed-off-by: Daniel Pittman <email@example.com>
In testing #9051 I introduced some tests that used the SQLite database adapter to test StoreConfigs. Not everywhere that did so was protected correctly, so machines without SQlite would blow up. Now everything is guarded the way it should be, and tests no longer explode. Signed-off-by: Daniel Pittman <firstname.lastname@example.org>
…urable' into 2.7.x * feature/2.7.x/9051-storeconfig-backend-should-be-configurable: (#9051) de-ActiveRecord-ify Collection expressions. (#9051) Port query tests into the indirection. (#9051) Implement the `resource` terminus for StoreConfigs. (#9051) Make generic tagging imported resource origins. (#9051) Whitespace cleanup for puppet/parser/collector (#9051) Dead code elimination in the compiler terminus. (#9051) Get the compiler out of the ActiveRecord business. (#9051) Implement the StoreConfigs indirection itself. (#9051) Add configuration around StoreConfigs indirection. Reviewed-by: Jeff McCune