|
95 | 95 | | CMD |
96 | 96 | } |
97 | 97 |
|
| 98 | + # Use PuppetDB's /pdb/admin/v1/archive API to SAVE data currently in PuppetDB. |
| 99 | + # Otherwise we'll completely lose it if/when we restore. |
| 100 | + # TODO: consider adding a heuristic to skip when innappropriate due to size |
| 101 | + # or other factors. |
| 102 | + if getvar('recovery_opts.puppetdb') { |
| 103 | + run_command(@("CMD"/L), $primary_target) |
| 104 | + /opt/puppetlabs/bin/puppet-db export ${shellquote($recovery_directory)}/puppetdb-archive.bin |
| 105 | + | CMD |
| 106 | + } |
| 107 | + |
98 | 108 | ## shutdown services |
99 | 109 | run_command(@("CMD"/L), $primary_target) |
100 | 110 | systemctl stop pe-console-services pe-nginx pxp-agent pe-puppetserver \ |
|
117 | 127 | | CMD |
118 | 128 | } |
119 | 129 |
|
120 | | - # TODO: Use PuppetDB's /pdb/admin/v1/archive API to SAVE data currently in |
121 | | - # PuppetDB. Otherwise we'll completely lose it if/when we restore. |
122 | | - |
123 | 130 | #$database_to_restore.each |Integer $index, Boolean $value | { |
124 | 131 | $restore_databases.each |$name,$database_targets| { |
125 | 132 | out::message("# Restoring ${name} database") |
|
190 | 197 | | CMD |
191 | 198 | } |
192 | 199 |
|
193 | | - # TODO: Use PuppetDB's /pdb/admin/v1/archive API to MERGE previously saved |
194 | | - # data into the restored database. |
| 200 | + # Use PuppetDB's /pdb/admin/v1/archive API to MERGE previously saved data |
| 201 | + # into the restored database. |
| 202 | + # TODO: consider adding a heuristic to skip when innappropriate due to size |
| 203 | + # or other factors. |
| 204 | + if getvar('recovery_opts.puppetdb') { |
| 205 | + run_command(@("CMD"/L), $primary_target) |
| 206 | + /opt/puppetlabs/bin/puppet-db import ${shellquote($recovery_directory)}/puppetdb-archive.bin |
| 207 | + | CMD |
| 208 | + } |
195 | 209 |
|
196 | 210 | # Use `puppet infra` to ensure correct file permissions, restart services, |
197 | 211 | # etc. Make sure not to try and get config data from the classifier, which |
|
0 commit comments