Subclassing a Custom Resource

Sometimes, you need to handle more complex situations, such as supporting distinctly different operating systems, such as Linux and Windows. This can easily be handled by subclassing your Custom Resource. Let's consider a new requirement for our use case, that is, we need to extend our new appsite Custom Resource cookbook so that it will allow us to create websites on OS X and Linux using Apache, and on Windows using IIS.

In order to provide for subclassing of our Custom Resource, we will need to convert them into a library module, so let's start there.

Convert our resource into a library module

We begin by creating a new folder named "libraries" in our cookbook. Next, we create a new file in our libraries folder named ...

Get Chef: Powerful Infrastructure Automation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.