Age | Commit message (Collapse) | Author |
|
Some modules or module versions don't have a metadata.json file, but we
might still want to use the load_module_metadata function on them. The
lack of a file can still give us important information. For example, it
might tell us that the version of the module installed is "very old"
even if we can't read the version number directly. This patch adds a
parameter to let the user specify if an empty file is acceptable. To
preserve backwards compatibility it does not change the current default
behavior, which is to raise an error if metadata.json does not exist.
|
|
`rake spec` only finds test files that end in _spec.rb, so this test
was not being run. Correct the path name so that the test runs
properly.
|
|
|
|
Maintain the old behavior in the case where the optional second
parameter isn't passed. Also, adding arity is backwards incompatible since
stdlib still supports 2.7, so remove that.
|
|
|
|
(MODULES-2561) add is_a function
|
|
[MODULES-2462] Improve parseyaml function
|
|
The data type system is very hard to understand. Many people don't
understand why
type_of([1,2,3]) == Array
will fail, but
type_of([1,2,3]) <= Array
passes. This does a simpler validation that doesn't rely on explicit
data types. Instead, use
$foo = [1,2,3]
if $foo.is_a(Array) {
notify { 'This is an array': }
}
This is based on code by Ben Ford <ben.ford@puppetlabs.com>.
* Added acceptance tests
* Added dispatch
* Improved unit tests
* Added docs to README
|
|
* previously the str2bool function did not accept 'TRUE' as a bool
type. This causes the function to now accept TRUE, FALSE strings
as a boolean type in order to be converted to a proper boolean.
* This would also cause Y,N, YES, NO to be accepted as boolean types
as well.
|
|
Add a new function "try_get_value"
|
|
* Extracts a value from a deeply-nested data structure
* Returns default if a value could not be extracted
|
|
Squashed, improved docs, updated error handling and unit tests by David S.
|
|
* Add default value support
Second argument will be returned if yaml cannot be parsed
instead of false value
* Update tests
|
|
|
|
Add spec tests to test the new functionality:
*Case for 3 arrays.
*Case for 4 arrays.
Modify README to note new functionality.
This is for issue MODULE-2456, follow the precedent of MODULE-444.
This change allows union to be much more useful, unioning many arrays
in one line rather than in n lines. Additionally, as this is only added
functionality, and does not affect the 2 array case that all modules
currently using array are using, it should not affect any existing
modules utilizing union.
This is now useful, for example, for merging many arrays of resources
(eg: packages.) to generate just one list with no duplicates, to avoid
duplicate resource declarations.
|
|
|
|
Add load_metadata_json function
|
|
This function loads the metadata.json into a puppet variable. This enables a number of neat things such as:
* Which version of the module am I using? 2.x? 3.x?
* Which author of the module am I using? puppetlabs? example42?
|
|
|
|
|
|
|
|
The time() function takes an argument of a timezone, and always returns
time in epoch format. The epoch format is the number of seconds that
have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap
seconds. This means that it is universally the same regardless of
timezones.
I don't know what the timezone argument is supposed to do, and it is not
documented. So lets just make 1.8.7 work like > 1.8.7
|
|
|
|
Previously, the random number generator was seeded with the array or
string to be rotated in addition to any values specifically provided for
seeding. This behavior is potentially insecure in that it allows an
attacker who can modify the source data to choose the post-shuffle
order.
|
|
Tests in the new style produces the following documentation output:
abs
should not eq nil
should run abs() and raise an Puppet::ParseError
should run abs(-34) and return 34
should run abs("-34") and return 34
should run abs(34) and return 34
should run abs("34") and return 34
|
|
Without this patch, Ruby 1.8's Hash#to_s behaviour causes [{1=>2}] to be
treated as "12" when validating values.
|
|
The rspec-puppet matchers don't allow to check the return types, but
this is a pretty rare thing to need to do anyway, so probably not worth
patching rspec-puppet
|
|
|
|
|
|
|
|
Check if file exists before loading with loadyaml. If not, return nil
|
|
|
|
support it.
|
|
Fix off-by-one error in validate_augeas_spec.rb that was causing rspec failure
Even without the gem installed always, this is helpful to avoid errors should augeas be enabled/installed due to something else.
|
|
(MODULES-1715) Add FQDN-based random string generator
|
|
|
|
|
|
|
|
See RFC 1123, Section 2.1
http://tools.ietf.org/html/rfc1123#section-2
|
|
Assert private
|
|
|
|
Dirname typecheck
|
|
As mentioned in #270, private is a reserved keyword in the future parser
which is to be released with Puppet 4. As it stands, this function is
not useable with the future parser so it needs to renamed.
This is a breaking change.
|
|
poikilotherm/feature/master/validate_integer_and_numeric
(MODULES-560) Add new functions validate_numeric() and validate_integer().
|
|
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
|
|
The previous commit to uriescape() changed the implementation to use the ruby default escape list for URI.escape(), but did not change the call triggered when uriescape() was called on an array, triggering ruby errors.
|
|
Add a ceiling function to complement the floor function.
|
|
only worry if the object responds to upcase
|
|
|
|
Fix is_domain_name() so it dup's its incoming argument
to avoid changing the original with a later chomp!
|