Skip to content

Commit

Permalink
Add link to upload_facts.rb script and documentation how to use it in…
Browse files Browse the repository at this point in the history
… Puppet upgrades to README (#30)

* Fix problem where a nodes details wouldn't load/show in puppet-catalog-diff-viewer when the JSON-file is generated on a Puppet Master that has server configuration config_version set to generate Epoch numbers. In this case these numbers where stored as numbers instead of strings in the JSON-file which caused puppet-catalog-diff-viewer to throw an exception when it tries to replace strange characters in the version string. I've verified this works in latest version of puppet-catalog-diff-viewer. See also conversation on #puppet here https://puppetcommunity.slack.com/archives/C0W298S9G/p1594642754396700.

* Added link to upload_facts.rb script and documentation for when it's useful and how it's recommended to be used in a Puppet upgrade.

* Clarified documentation about which Puppet versions the upload_facts.rb script should work fine on after discussion with raphink on #30.
  • Loading branch information
JohnEricson authored Jul 20, 2020
1 parent 0c080f4 commit 967bd3a
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ that the node is still active. This filtered list
should contain only machines that have not been decommissioned in PuppetDB (important
as compiling their catalogs would also reactive them and their exports otherwise).

When you are comparing between different versions of Puppet using two Master servers
you are going to need to copy facts from the old Master to the new one in order to be
able to compile catalogs on the new Master. This is useful when upgrading Puppet version.

To upload facts to PuppetDB on a Master see the [Upload facts](#upload-facts-to-puppetdb) script.


## Usage

Expand Down Expand Up @@ -178,6 +184,37 @@ viewed in markdown using the Rakefile in this directory.
A web viewer is also available at [https://github.com/camptocamp/puppet-catalog-diff-viewer](https://github.com/camptocamp/puppet-catalog-diff-viewer)


## See also

### Upload facts to PuppetDB

Standalone Ruby script `upload_facts.rb` that is used to upload yaml files with facts to
PuppetDB. This is useful when you are upgradering Puppet version and uses two different
Puppet Masters for this. Then you can use this script to upload facts from the old Master
to the new one. The script can also be used to just refresh the facts in PuppetDB from
the old Master. These facts are required to be able to compile the catalogs on the new
Master.

The script uses yaml-files in the same format as stored on the Puppet Master when real
agents report their facts at the beginning of a Puppet Agent execution.

The script is developed to be executed on the Puppet Master, so the yaml-facts files
should be copied to the new Master using scp or similar, preferably to the
`$(puppet config print vardir)/yaml/facts` directory.

Then all files in the directory can be uploaded to PuppetDB by using this command:

```shell
$ ./upload_facts.rb $(puppet config print vardir)/yaml/facts/*.yaml
```

The script is available at [https://github.com/JohnEricson/upload_facts](https://github.com/JohnEricson/upload_facts).

It's been verified to work with uploading facts from Puppet Masters running Puppet
version 3 to Masters running version 5. It uses the [`/puppet/v3/facts/` API](https://puppet.com/docs/puppet/6.17/http_api/http_facts.html)
which is available in version 3 and >= 5 of Puppet. This API was removed in Puppet 4 but
added again in 5.

## Authors
R.I.Pienaar <rip@devco.net> / www.devco.net / @ripienaar
Zack Smith <zack@puppetlabs.com> / @acidprime
Expand Down

0 comments on commit 967bd3a

Please sign in to comment.