I'm running a postgres inspec profile and would like to run certain tests only if the node is a master node. Here is my profile
sql = postgres_session('postgres', password, 'localhost')
result = describe sql.query('SELECT pg_is_in_recovery()') do
its('output') { should eq 'f' }
end
if result == 'f'
describe sql.query('SELECT state from pg_stat_replication') do
its('output') { should match 'streaming' }
end
end
But this doesn't work as the variable result doesn't store value 'f'.
My question is how do i store a value in a variable and use that for the next test in inspec ? How do we print variable values in inspec (debug statements)