summaryrefslogtreecommitdiff
path: root/lib/chef/property.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate creating properties whose names are already methodsadamleff/warn-on-dangerous-property-namesAdam Leff2017-01-181-0/+31
| | | | | | | | | | | | | | | | When creating a resource, a user can create a property that is the same name as an already-existing Ruby method, such as `#hash`. In the case of the `#hash` method, this can cause issues when attempting to adding resources to other data structures, such as Arrays or Hashes. In other examples, this could cause unexpected behavior that is incredibly difficult to troubleshoot. This change adds a deprecation warning in the case where a user adds a property to a resource that the resource instance already responds to. If y'all are OK with this approach, I'll be happy to write up the deprecation doc for this for docs.chef.io. Signed-off-by: Adam Leff <adam@leff.co>
* Structure deprecations with additional metadatatm/deprecation_with_urlThom May2016-11-161-5/+5
| | | | | | | | This adds URLs to each class of deprecation, and correctly prints and formats them for maximum user efficiency. We also provide the URL to the data collector for Visibility to ingest. Signed-off-by: Thom May <thom@chef.io>
* improve property-resource namespace collision exceptionLamont Granquist2016-10-311-4/+4
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Allow flagging a resource property as sensitiveadamleff/sensitive-propertiesAdam Leff2016-08-251-1/+12
| | | | | | | | | | | | Some properties in custom resources may include sensitive data, such as a password for a database server. When the Resource's state is built for use by Data Collector or similar auditing tool, `Chef::Resource#state_for_resource_reporter` builds a hash of all state properties for that resource and their values. This leads to sensitive data being transmitted and potentially stored in the clear. This change enhances properties with the ability to set an individual property as sensitive and then have the value of that property suppressed when exporting the Resource's state.
* fix Style/BlockDelimiters, Style/MultilineBlockLayout and 0.42.0 engine upgradeLamont Granquist2016-08-171-2/+2
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* tweak 3694 warningsLamont Granquist2016-07-011-2/+6
| | | | | | | | - clean up "ZenMaster" resource - clean up 3694 detection to use properties - unlazy the resource_name in the trivial resource check - fixes an issue with resources-as-definitions pattern emitting 3694 errors for trivial resources
* add nillable apt_repository and nillable propertiesLamont Granquist2016-04-141-2/+9
| | | | | | in Chef-13 nillable will become 'true' by default and we'll have to deprecate and remove all nillable properties, but for now this lets us opt-in, which was can't currently do in Chef-12.
* Issue 4334: Because set(property, nil) gets turned into get(property), add a ↵cd/fix-spurious-warningsChris Doherty2016-03-111-3/+4
| | | | 'nil_set' parameter to get() to skip a spurious warning when that happens.
* Fix property coercion in both places, because they were different and Noah Kantrowitz2016-03-091-1/+1
| | | one in Chef::Mixin::Properties would result in duplicated values.
* convert MultilineOperationIndentation style to "indented"Lamont Granquist2016-02-121-7/+7
| | | | this looks nicer.
* autofixing whitespace copsLamont Granquist2016-02-051-11/+10
| | | | | | | | | | | | | | | | | | | | | | 4174 Style/SpaceInsideHashLiteralBraces 1860 Style/SpaceAroundOperators 1336 Style/SpaceInsideBlockBraces 1292 Style/AlignHash 997 Style/SpaceAfterComma 860 Style/SpaceAroundEqualsInParameterDefault 310 Style/EmptyLines 294 Style/IndentationConsistency 267 Style/TrailingWhitespace 238 Style/ExtraSpacing 212 Style/SpaceBeforeBlockBraces 166 Style/MultilineOperationIndentation 144 Style/TrailingBlankLines 120 Style/EmptyLineBetweenDefs 101 Style/IndentationWidth 82 Style/SpaceAroundBlockParameters 40 Style/EmptyLinesAroundMethodBody 29 Style/EmptyLinesAroundAccessModifier 1 Style/RescueEnsureAlignment
* Copyright year update for 2016 and massive cleanup.Noah Kantrowitz2016-02-021-1/+1
| | | Generated via git ls-files | xargs perl -pi -e "s/[Cc]opyright (?:\([Cc]\) )?((?\!$(date +%Y))\\d{4})(-\\d{4})?([, ][ \d]+)*(,|(?= ))/Copyright \\1-$(date +%Y),/g"
* Simplify fix for property_type with defaultsjk/property-type-default-checkJohn Keiser2016-02-011-1/+1
| | | | `property_type(is: [:a, :b], default: :c)` was broken because ParamsValidate requires its input to have a name and property types don't have one.
* Fix defaults on property_typeJohn Keiser2016-02-011-2/+7
|
* Fix nil with properties:John Keiser2016-01-271-34/+95
| | | | | | 1. Warn when default values are invalid. 2. Never validate nil (on set or get) if there is no default. 3. Emit "will be invalid in Chef 13" warning when setting an invalid nil value.
* Fix #4334: don't warn about ambiguous property usageJohn Keiser2016-01-221-1/+2
| | | | unless using properties on the resource
* Use double quotes by defaultThom May2016-01-141-4/+4
| | | | | | | This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
* Only warn about potentially duplicate properties during the resource initializerjk/reduce-property-dup-warningJohn Keiser2015-12-141-3/+6
|
* Don't warn when setting a property to nil unless its value wouldjk/updates2John Keiser2015-12-141-8/+11
| | | | | actually change. Gets rid of cases where we are initializing a resource with values from another resource.
* Get rid of ambiguity with `template 'x' do ...`jk/error-on-property-with-blockJohn Keiser2015-12-101-2/+10
|
* Improve commentsjk/warn-dup-propertyJohn Keiser2015-12-101-3/+15
|
* Warn when user sets a property of an inline resource to itself.John Keiser2015-12-101-0/+10
| | | | (User will expect "x x" to grab the parent property.)
* Make Property.derive create derived properties of the same typejk/custom_propertiesJohn Keiser2015-10-281-1/+1
|
* Accept coercion as a way to accept nil valuesJohn Keiser2015-10-081-1/+4
|
* Add ability for default to override name_propertyjk/name-defaultJohn Keiser2015-09-291-4/+7
|
* Make sure name_attribute works on derived propertiesjk/name-attribute-dupJohn Keiser2015-09-291-1/+7
|
* Use 2.0-compatible Hash rather than to_hJohn Keiser2015-09-251-1/+1
|
* If both name_attribute and name_property are specified, raise an error.jk/property-default-nilJohn Keiser2015-09-251-19/+20
|
* Don't treat name_property/attribute as defaults if they are falseJohn Keiser2015-09-251-1/+5
|
* Fix up property deprecation textJohn Keiser2015-09-251-1/+1
|
* Prefer name_property: true over default: nilJohn Keiser2015-09-251-11/+12
|
* Add deprecation warning for properties that specify default and name_propertyjk/default-ignoringJohn Keiser2015-09-221-7/+9
|
* Honor the ordering of whichever `name_attribute` or `default` comes firstJohn Keiser2015-09-221-0/+15
|
* Rename log.deprecation to log_deprecationJohn Keiser2015-09-011-1/+1
|
* Pass deprecations through formatter instead of logsJohn Keiser2015-09-011-1/+1
|
* Remove freeze of defaults, add warning for array/hash constant defaultsJohn Keiser2015-08-031-4/+1
|
* Don't set keys unless you must (for easier debugging)John Keiser2015-07-271-1/+1
|
* Move property type derivation from "property_type" to "property"John Keiser2015-07-031-46/+7
| | | | to keep property_type simple
* Add Property.create and Resource.property_type for type system overridingJohn Keiser2015-07-031-9/+83
|
* Bring set_or_return behavior back in line with what it used to beJohn Keiser2015-07-031-13/+0
|
* Only stick non-frozen values to the resourceJohn Keiser2015-07-031-4/+12
|
* Code review commentsJohn Keiser2015-07-031-6/+24
|
* Make required name attributes workJohn Keiser2015-07-031-0/+491