puppetdb_foreman 5.0.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -13
  3. data/Rakefile +9 -6
  4. data/app/controllers/api/v2/puppetdb_nodes_controller.rb +8 -6
  5. data/app/controllers/puppetdb_foreman/nodes_controller.rb +22 -8
  6. data/app/helpers/concerns/puppetdb_foreman/hosts_helper_extensions.rb +5 -3
  7. data/app/models/concerns/orchestration/puppetdb.rb +13 -6
  8. data/app/models/puppetdb_foreman/host_extensions.rb +5 -4
  9. data/app/services/puppetdb.rb +8 -12
  10. data/app/services/puppetdb_client/base.rb +8 -6
  11. data/app/services/puppetdb_client/v4.rb +48 -1
  12. data/app/services/puppetdb_host.rb +4 -2
  13. data/app/views/api/v2/puppetdb_nodes/import.json.rabl +2 -0
  14. data/app/views/api/v2/puppetdb_nodes/index.json.rabl +2 -0
  15. data/app/views/api/v2/puppetdb_nodes/unknown.json.rabl +2 -0
  16. data/config/routes.rb +11 -9
  17. data/db/migrate/20170717140010_migrate_puppetdb_api_version_setting.rb +4 -2
  18. data/db/migrate/20181001113836_remove_puppetdb_dashboard_address_setting.puppetdb_foreman.rb +3 -1
  19. data/lib/puppetdb_foreman/engine.rb +55 -27
  20. data/lib/puppetdb_foreman/version.rb +3 -1
  21. data/lib/puppetdb_foreman.rb +2 -0
  22. data/lib/tasks/puppetdb_foreman_tasks.rake +4 -4
  23. data/test/controllers/api/v2/puppetdb_nodes_controller_test.rb +60 -55
  24. data/test/controllers/nodes_controller_test.rb +7 -6
  25. data/test/models/host_test.rb +5 -4
  26. data/test/test_plugin_helper.rb +2 -4
  27. data/test/unit/puppetdb_host_test.rb +5 -4
  28. data/test/unit/puppetdb_test.rb +18 -135
  29. metadata +17 -23
  30. data/app/models/setting/puppetdb.rb +0 -49
  31. data/app/services/puppetdb_client/v1.rb +0 -33
  32. data/app/services/puppetdb_client/v3.rb +0 -49
  33. data/test/static_fixtures/query_nodes.json +0 -61
@@ -1,49 +0,0 @@
1
- module PuppetdbClient
2
- class V3 < Base
3
- # The payload is formatted as a JSON map.
4
- # certname: The name of the node for which the catalog was compiled.
5
- # producer_timestamp: The time of command submission.
6
- def deactivate_node_payload(nodename)
7
- {
8
- 'command' => 'deactivate node',
9
- 'version' => 3,
10
- 'payload' => {
11
- 'certname' => nodename,
12
- 'producer_timestamp' => producer_timestamp
13
- }
14
- }.to_json
15
- end
16
-
17
- def command_url
18
- '/pdb/cmd/v1'
19
- end
20
-
21
- def nodes_url
22
- '/pdb/query/v4/nodes'
23
- end
24
-
25
- def facts_url
26
- '/pdb/query/v4/facts'
27
- end
28
-
29
- def resources_url
30
- '/pdb/query/v4/resources'
31
- end
32
-
33
- def query_nodes
34
- super.map { |node| node['certname'] }
35
- end
36
-
37
- private
38
-
39
- def post_options
40
- {
41
- content_type: :json
42
- }
43
- end
44
-
45
- def producer_timestamp
46
- Time.now.iso8601.to_s
47
- end
48
- end
49
- end
@@ -1,61 +0,0 @@
1
- [ {
2
- "name" : "server1.example.com",
3
- "deactivated" : null,
4
- "catalog_timestamp" : "2017-04-20T15:07:27.114Z",
5
- "facts_timestamp" : "2017-04-20T15:06:52.738Z",
6
- "report_timestamp" : null
7
- }, {
8
- "name" : "server2.example.com",
9
- "deactivated" : null,
10
- "catalog_timestamp" : "2017-04-20T15:06:28.282Z",
11
- "facts_timestamp" : "2017-04-20T15:06:12.253Z",
12
- "report_timestamp" : null
13
- }, {
14
- "name" : "server3.example.com",
15
- "deactivated" : null,
16
- "catalog_timestamp" : "2017-04-20T15:12:56.090Z",
17
- "facts_timestamp" : "2017-04-20T15:12:32.117Z",
18
- "report_timestamp" : null
19
- }, {
20
- "name" : "server4.example.com",
21
- "deactivated" : null,
22
- "catalog_timestamp" : "2017-04-20T15:04:01.154Z",
23
- "facts_timestamp" : "2017-04-20T15:03:38.150Z",
24
- "report_timestamp" : null
25
- }, {
26
- "name" : "server5.example.com",
27
- "deactivated" : null,
28
- "catalog_timestamp" : "2017-04-20T15:20:06.853Z",
29
- "facts_timestamp" : "2017-04-20T15:19:49.088Z",
30
- "report_timestamp" : null
31
- }, {
32
- "name" : "server6.example.com",
33
- "deactivated" : null,
34
- "catalog_timestamp" : "2017-04-20T15:21:11.520Z",
35
- "facts_timestamp" : "2017-04-20T15:20:57.685Z",
36
- "report_timestamp" : null
37
- }, {
38
- "name" : "server7.example.com",
39
- "deactivated" : null,
40
- "catalog_timestamp" : "2017-04-20T15:15:37.033Z",
41
- "facts_timestamp" : "2017-04-20T15:15:13.918Z",
42
- "report_timestamp" : null
43
- }, {
44
- "name" : "server8.example.com",
45
- "deactivated" : null,
46
- "catalog_timestamp" : "2017-04-20T15:19:18.236Z",
47
- "facts_timestamp" : "2017-04-20T15:19:02.659Z",
48
- "report_timestamp" : null
49
- }, {
50
- "name" : "server9.example.com",
51
- "deactivated" : null,
52
- "catalog_timestamp" : "2017-04-20T14:39:35.070Z",
53
- "facts_timestamp" : "2017-04-20T14:39:19.003Z",
54
- "report_timestamp" : null
55
- }, {
56
- "name" : "server10.example.com",
57
- "deactivated" : null,
58
- "catalog_timestamp" : "2017-04-20T15:17:06.209Z",
59
- "facts_timestamp" : "2017-04-20T15:16:50.007Z",
60
- "report_timestamp" : null
61
- } ]