Skip to content

Commit 8d9df39

Browse files
committed
(PUP-8342) Update report serialization/deserialization, schema, and schema version to include transaction_completed
This update adds transaction_completed to report serialization/deserialization, and schema, and updates the schema version.
1 parent 4bfbc99 commit 8d9df39

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

api/docs/http_report.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ example is formatted for readability)
5555
"job_id"=>null,
5656
"catalog_uuid"=>"827a74c8-cf98-44da-9ff7-18c5e4bee41e",
5757
"catalog_format"=>1,
58-
"report_format"=>7,
58+
"report_format"=>8,
5959
"puppet_version"=>"5.0.0",
6060
"status"=>"unchanged",
61+
"transaction_completed"=>true,
6162
"noop"=>false,
6263
"noop_pending"=>false,
6364
"environment"=>"test_environment",

api/schemas/report.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"report_format",
1515
"puppet_version",
1616
"status",
17+
"transaction_completed",
1718
"noop",
1819
"noop_pending",
1920
"environment"
@@ -126,7 +127,7 @@
126127
"report_format": {
127128
"description": "The report format version documented by this schema",
128129
"type": "integer",
129-
"enum": ["7", 7]
130+
"enum": ["8", 8]
130131
},
131132

132133
"puppet_version": {
@@ -143,6 +144,11 @@
143144
]
144145
},
145146

147+
"transaction_completed": {
148+
"description": "Whether the transaction completed (e.g. didn't have an unrescued exception).",
149+
"type": "boolean"
150+
},
151+
146152
"noop": {
147153
"description": "Whether the puppet run was started in noop mode",
148154
"type": "boolean"

lib/puppet/transaction/report.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def initialize(configuration_version=nil, environment=nil, transaction_uuid=nil,
218218
@external_times ||= {}
219219
@host = Puppet[:node_name_value]
220220
@time = Time.now
221-
@report_format = 7
221+
@report_format = 8
222222
@puppet_version = Puppet.version
223223
@configuration_version = configuration_version
224224
@transaction_uuid = transaction_uuid
@@ -243,6 +243,7 @@ def initialize_from_hash(data)
243243
@transaction_uuid = data['transaction_uuid']
244244
@environment = data['environment']
245245
@status = data['status']
246+
@transaction_completed = data['transaction_completed']
246247
@noop = data['noop']
247248
@noop_pending = data['noop_pending']
248249
@host = data['host']
@@ -304,6 +305,7 @@ def to_data_hash
304305
'report_format' => @report_format,
305306
'puppet_version' => @puppet_version,
306307
'status' => @status,
308+
'transaction_completed' => @transaction_completed,
307309
'noop' => @noop,
308310
'noop_pending' => @noop_pending,
309311
'environment' => @environment,

spec/unit/transaction/report_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ def expect_equivalent_reports(tripped, report)
587587
expect(tripped.report_format).to eq(report.report_format)
588588
expect(tripped.puppet_version).to eq(report.puppet_version)
589589
expect(tripped.status).to eq(report.status)
590+
expect(tripped.transaction_completed).to eq(report.transaction_completed)
590591
expect(tripped.environment).to eq(report.environment)
591592
expect(tripped.corrective_change).to eq(report.corrective_change)
592593

0 commit comments

Comments
 (0)