Questions tagged [lwrp]

An LWRP is a part of a cookbook that is used to extend the chef-client in a way that allows custom actions to be defined, and then used in recipes in much the same way as any platform resource.

An LWRP is a part of a cookbook that is used to extend the chef-client in a way that allows custom actions to be defined, and then used in recipes in much the same way as any platform resource. A LWRP has two principal components:

  • A lightweight resource that defines a set of actions and attributes
  • A lightweight provider that tells the chef-client how to handle each action, what to do if certain conditions are met, and so on In addition, most lightweight providers are built using platform resources and some lightweight providers are built using custom Ruby code

Once created, a LWRP becomes a Ruby class within the organization. During each chef-client run, the chef-client will read the lightweight resources from recipes and process them alongside all of the other resources. When it is time to configure the node, the chef-client will use the corresponding lightweight provider to determine the steps required to bring the system into the desired state.

Where the lightweight resource represents a piece of the system, its current state, and the action that is needed to move it to the desired state, a lightweight provider defines the steps that are required to bring that piece of the system from its current state to the desired state. A LWRP behaves similar to platform resources and providers:

  • A lightweight resource is a key part of a recipe
  • A lightweight resource defines the actions that can be taken
  • During a chef-client run, each lightweight resource is identified, and then associated with a lightweight provider
  • A lightweight provider does the work to complete the action requested by the lightweight resource

You can read more about how to build custom lightweight resources on the Chef docs.

73 questions
2
votes
2 answers

Using a helper with a provider-less, 12.5-style custom resource (LWRP) in Chef

cookbook/libraries/rn_helper.rb: def sample_func puts "woohoo" end cookbook/resources/rn.rb: action :create do sample_func end The above code works perfectly. The below code does not: cookbook/libraries/rn_helper.rb: module SampleModule …
MaxVT
  • 12,989
  • 6
  • 36
  • 50
2
votes
1 answer

Adding a provider or extending a LWRP for a wrapped cookbook

(sorry about the links, I can't post more than two..) I am trying to add a provider to a cookbook that wraps another cookbooks which holds a LWRP. The wrapped cookbook is poise Python supervisor: [github.com/poise/supervisor.git][1] I am using…
Michael
  • 81
  • 9
2
votes
2 answers

How to skip resource :create action when needed

I have a custom LWRP with just a :create action (which is also set to the default action). Now every time I converge my node the action the LWRP action is performed adding to the final count of updated resources. I noticed that other resources have…
SystematicFrank
  • 16,555
  • 7
  • 56
  • 102
2
votes
1 answer

Update node tags from Chef LWRP

For a given use case, I need to update a node's tags through a custom LWRP. I have tried two approaches: using 'tag'/'untag'. This yields the error: No resource or method named `tag' for ... using node[:tags].concat(). This works…
jhdzmar
  • 43
  • 6
2
votes
2 answers

How to use the python LWRP with Opsworks/Chef 11

I am new to Chef/OpsWorks and am attempting a simple recipe to install Django 1.6 on an Ubuntu 12.04 instance: python_pip "Django" do version "1.6" action :install end My providers/pip.rb and providers/virtualenv.rb seem to override what,…
alphanumeric0
  • 45
  • 1
  • 5
1
vote
1 answer

Oculus Quest Single-Pass and Multi-Pass not working?

I am using the following configuration: Unity: 2019.2.13f1 Device: Oculus Quest Using LWRP Issues: (a) When I change the "Stereo Rendering Mode" to "Single-Pass", the rendering of the screen is too small and too far. (b) When I change the "Stereo…
user12285218
1
vote
0 answers

Change Camera Renderer Data via script

Does anyone know how to access and change the Renderer Data of Camera via script? My purpose is this: public bool ActiveDepth; public Camera myCamera; public RendererData renderClassic; public RendererData renderDepth; // if active get depth…
Alberto
  • 274
  • 1
  • 5
  • 16
1
vote
2 answers

High camera position in Unity3D LWRP only shows gray materials

I'm quite new in Unity lightweight render pipeline and in my current prototype I've noticed a behaviour which surprised me a bit since I've never seen it using the built-in or the high definition render pipeline. I have a simple cube and I've…
Yheeky
  • 207
  • 1
  • 3
  • 10
1
vote
0 answers

Unity unsupported shader on iPhone 6s

I'm making a game for Android and iOS. It is quite a simple project so all materials use LWRP Lit shader. I was trying to make build on iPhone 6s and iPhone XR. On each my Android device and on iPhone XR it works well. But on iPhone 6s I get freeze…
EFES
  • 11
  • 2
1
vote
1 answer

Chef NoMethodError when using library module method with registry_key in recipe

I receive the error NoMethodError ------------- undefined method `registry_key' for HashOperations:Module when converging a Chef cookbook. This is the short version of the code from libraries/hash_operations.rb: module HashOperations # Tried:…
tibileo
  • 73
  • 1
  • 9
1
vote
1 answer

In chef custom resource how to specify that a key value pair is mandatory

While writing custom resources in chef we define attributes, their type, their default value and whether they are mandatory to be specified or not, e.g. attribute :plugin, kind_of: String, required: true attribute :after_plugin, kind_of:…
Ivan
  • 169
  • 10
1
vote
2 answers

Private method in custom resource does not work

I would like to do similar thing using Custom Resource: Here is provider code (LWRP) which works action :create my_private_method(a) my_private_method(b) end private def my_private_method(p) (some code) end If I make similar code using…
zdenko.s
  • 931
  • 1
  • 12
  • 29
1
vote
2 answers

How to get notifications between Poise LWRP in Chef

I'm attempting to learn more about LWRP's and have a working provider that installs a package. I am stuck trying to notify my service when configuration changes - basically I have this below. Can I make the runit service subscribe to notifications…
MikeW
  • 4,749
  • 9
  • 42
  • 83
1
vote
1 answer

Using chef-vault in an lwrp

Hey peoples of the internet, Can someone tell me the magical incantation to get chef-vault working in an LWRP? So far, I have these pieces and they don't seem to be working. In my metadata.rb file I have depends "chef-vault" in my provider, I've…
user1079703
  • 442
  • 6
  • 15
1
vote
1 answer

Continuous Chef FC016 FoodCritic Error

I am trying to test creation of my own LWRP. I keep getting the following error message, even though I have tried specifying my default_action in three different ways. Error Message: FC016: LWRP does not declare a default action:…
Ishu Gupta
  • 1,071
  • 1
  • 19
  • 43