Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LMacchi committed Mar 23, 2018
1 parent 8ce9ae0 commit 09dfd5a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ In the example below we have referred to `centos6a` and `centos7b` in all of our
- **type** *statement or rvalue*
- **returns** *Optional: A value to return*

**before and after conditions** We can set `before` and `after` blocks before each spec test. These are usually used when the functions to stub are conditional: stub functionx if the OS is windows, stub functiony if the fact java_installed is true. The facts are available through the `node_facts` hash.
**before and after conditions** We can set `before` and `after` blocks before each spec test. These are usually used when the functions to stub are conditional: stub functionx if the OS is windows, stub functiony if the fact java_installed is true. The facts are available through the `node_facts` hash and the trusted facts as `trusted_facts`.

```yaml
before:
Expand Down Expand Up @@ -250,6 +250,27 @@ Once we have our factset all we need to do is copy it into `spec/factsets/` insi

Would map to a node named `server2008r2` in `onceover.yaml`

#### Trusted Facts

You can add trusted facts to the nodesets by creating a new section called trusted:

```
{
"name": "node.puppetlabs.net",
"trusted": {
"pp_role": "agent",
"pp_datacenter": "puppet",
"pp_created_by": "laura"
},
"values": {
"aio_agent_build": "1.10.4",
"aio_agent_version": "1.10.4",
"architecture": "x86_64",
```

Notice that the `extensions` part is implied. The first fact in that example translates to `$trusted['extensions']['pp_role']` in Puppet code.

### nodesets

`spec/acceptance/nodesets/onceover-nodes.yml`
Expand Down

0 comments on commit 09dfd5a

Please sign in to comment.