diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-22 14:26:34 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-30 11:52:24 -0700 |
commit | d08274d635b046210faf07d7f598fee5b3c3effe (patch) | |
tree | eae7c43c4263749d458c06f609b3c7ef2ef997c2 /lib/chef/dsl | |
parent | 2151e4f1563441fdacc07c16eaaa4273bb88931d (diff) | |
download | chef-d08274d635b046210faf07d7f598fee5b3c3effe.tar.gz |
Chef-13: Support nameless resources and remove deprecated multi-arg resources
This makes nameless resources work in the DSL:
```ruby
apt_update
```
It does it by giving it an empty-string name of ""
It also drops support for multi-arg resources, that has been deprecated
for some time:
```ruby
some_resource "foo", "bar", "baz"
```
Note that multipackage package resources do not use multiple args, but a
single argument which is an arry:
```ruby
package [ "lsof", "strace", "tcpdump" ]
```
So this change does not affect that usage. Multi-arg has been
deprecated for some time now and its not clear that it was ever used by
anyone.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/dsl')
-rw-r--r-- | lib/chef/dsl/resources.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/chef/dsl/resources.rb b/lib/chef/dsl/resources.rb index 36ec018500..4baec22f2e 100644 --- a/lib/chef/dsl/resources.rb +++ b/lib/chef/dsl/resources.rb @@ -34,11 +34,10 @@ class Chef def self.add_resource_dsl(dsl_name) module_eval(<<-EOM, __FILE__, __LINE__ + 1) - def #{dsl_name}(*args, &block) - Chef.deprecated(:internal_api, "Cannot create resource #{dsl_name} with more than one argument. All arguments except the name (\#{args[0].inspect}) will be ignored. This will cause an error in Chef 13. Arguments: \#{args}") if args.size > 1 - declare_resource(#{dsl_name.inspect}, args[0], created_at: caller[0], &block) - end - EOM + def #{dsl_name}(arg = "", &block) + declare_resource(#{dsl_name.inspect}, arg, created_at: caller[0], &block) + end + EOM end def self.remove_resource_dsl(dsl_name) |