# Question concerning actions in resources and providers

**URL:** <https://discourse.chef.io/t/question-concerning-actions-in-resources-and-providers/13255>\
**Category:** Chef Infra (archive)\
**Created:** [July 3, 2018, 1:59am UTC](https://discourse.chef.io/t/question-concerning-actions-in-resources-and-providers/13255 "2018-07-03T01:59:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rooty0](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/rooty0/32/2298_2.png) [@rooty0](https://discourse.chef.io/u/rooty0)\
**Post date:** [July 3, 2018, 1:59am UTC](https://discourse.chef.io/t/question-concerning-actions-in-resources-and-providers/13255/1 "2018-07-03T01:59:44Z")

</div>

Greetings,

I’m a bit lost how this works:

**resources/ring.rb**

```
actions :set
default_action :set

property :interface, String, name_property: true
property :rx, Integer
property :tx, Integer

load_current_value do
  rx 512
  tx 512
end

```

**providers/ring.rb**

```
use_inline_resources

action :set do

  converge_if_changed :rx do
    log 'aaa' do
      message 'aaaa'
      level :info
    end
  end

  converge_if_changed :tx do
    log 'bbbb' do
      message 'bbbb'
      level :info
    end
  end

end

```

**recipes/default.rb**

```
mycookbook_ring 'eth0' do
  rx 512
  tx 512
end

```

For some reason chef ignores **load\_current\_value** block and as a result **converge\_if\_changed** is always _true_.

Tho it works as designed if I append all stuff from **providers/ring.rb** to **resources/ring.rb**.

I have :

```
# chef-client -v
Chef: 12.21.3

```

Is this a bug or feature? Seems like it’s pointless to use **providers/** \* then

---

<div class="post-metadata">

**Author:** ![rooty0](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/rooty0/32/2298_2.png) [@rooty0](https://discourse.chef.io/u/rooty0)\
**Post date:** [July 3, 2018, 5:34pm UTC](https://discourse.chef.io/t/question-concerning-actions-in-resources-and-providers/13255/2 "2018-07-03T17:34:26Z")

</div>

One more question, is “ **/providers** ” directory deprecated? I also can’t really find any examples how to work with **providers** , tho I can see a lot of examples for **/resources**.

---

<div class="post-metadata">

**Author:** ![coderanger](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/coderanger/32/5_2.png) [@coderanger](https://discourse.chef.io/u/coderanger)\
**Post date:** [July 3, 2018, 5:40pm UTC](https://discourse.chef.io/t/question-concerning-actions-in-resources-and-providers/13255/3 "2018-07-03T17:40:17Z")

</div>

The older style isn’t deprecated per se, there just isn’t much reason to use it these days. Since 12.5, the preferred style is to include both the resource description and action code in one file (under `resources/`). You can’t mix-and-match on style, and `load_current_value` and `converge_if_changed` are part of the newer style “custom resource” (vs. “LWRP” for the older style, though both end up creating resource classes so the naming is a bit wibbly).

---

<div class="post-metadata">

**Author:** ![rooty0](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/rooty0/32/2298_2.png) [@rooty0](https://discourse.chef.io/u/rooty0)\
**Post date:** [July 3, 2018, 5:55pm UTC](https://discourse.chef.io/t/question-concerning-actions-in-resources-and-providers/13255/4 "2018-07-03T17:55:55Z")

</div>

I see, thanks a lot. I did some research and haven’t found that “providers” are considered as old style, good to know.
