File: 05-implementing-the-transport-hints.md

package info (click to toggle)
ruby-puppet-resource-api 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,232 kB
  • sloc: ruby: 9,573; sh: 4; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 963 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
## Implementing the transport - Exercise

Implement the `request_debug` option that you can toggle on to create additional debug output on each request. If you get stuck, review the hints below, or [the finished file](TODO).

## Hints

* You can create a toggle option with the `Boolean` (`true` or `false`) data type. Add it to the `connection_info` in the transport schema.

* Make it an `Optional[Boolean]` so that users who do not require request debugging do not have to specify the value.

* To remember the value you passed, store `connection_info[:request_debug]` in a `@request_debug` variable.

* In the `hue_get` and `hue_put` methods, add `context.debug(message)` calls showing the method's arguments.

* Make the debugging optional based on your input by appending `if @request_debug` to each logging statement.

# Next Up

Now that the transport can talk to the remote target, it's time to [implement a provider](./06-implementing-the-provider.md).