Skip to content

Commit

Permalink
update docs with examples to set valid platform family
Browse files Browse the repository at this point in the history
Signed-off-by: Sathish Babu <[email protected]>
  • Loading branch information
sathish-progress committed Feb 7, 2024
1 parent 0f55383 commit e25a78f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ If your transport is OS based and has the option to read a file you can set this
If your transport is OS based and has the option to run a command you can set this method. It is expected to return a `CommandResult` class here to be used upstream in InSpec. Currently the command resource is restricted to Unix and Windows platforms. Caching is enabled by default for this method.
You can optionally receive an options hash as well as the command string. This is intended for options that apply only to the current instance of running a command. For example, applying a timeout to this command execution.

**In order to run file and commands OS based, please make sure the platform family belongs to a valid OS. Example config is provided below.

#### API Access Methods

When working with API's it's often helpful to create methods to return client information or API objects. These are then accessed upstream in InSpec. Here is an example of a API method you may have:
Expand Down Expand Up @@ -144,3 +146,12 @@ def platform
)
end
```
Example config for transport that supports `unix` and `windows` OS,

```Ruby
def platform
Train::Platforms.name("local-rot13").in_family("unix")
Train::Platforms.name("local-rot13").in_family("windows")
force_platform!("local-rot13", release: TrainPlugins::LocalRot13::VERSION)
end
```

0 comments on commit e25a78f

Please sign in to comment.