Skip to content

Commit

Permalink
Merge branch 'utkarsh079-utkarsh_onlyif_prc_fix_condition'
Browse files Browse the repository at this point in the history
  • Loading branch information
southalc committed Dec 21, 2024
2 parents d6a0be3 + 5cd8512 commit 46fbfc5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Release 0.7.6
- Bugfix. fixing the onlyi_prc condition #94. Contributed by utkarsh079

## Release 0.7.5
- Bugfix. Resolve image name to ID before fetching digest to resolve false drift #92. Contributed by optiz0r

Expand Down
2 changes: 1 addition & 1 deletion manifests/container.pp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@

$onlyif_prc = @("END"/L)
test $(podman container inspect --format json ${container_name} |\
${_ruby} -rjson -e 'puts (JSON.parse(STDIN.read))[0]["State"]["Running"]') =
${_ruby} -rjson -e 'puts (JSON.parse(STDIN.read))[0]["State"]["Running"]') = true
| END

# Try to stop the container service, then the container directly
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "southalc-podman",
"version": "0.7.5",
"version": "0.7.6",
"author": "Chris Southall",
"summary": "Manage podman containers with puppet",
"license": "Apache-2.0",
Expand Down
8 changes: 4 additions & 4 deletions spec/defines/container_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@

remove_onlyif = if %r{^\/opt\/puppetlabs\/}.match?(os_facts[:ruby]['sitedir'])
<<-END.gsub(%r{^\s+\|}, '')
|test $(podman container inspect --format json namevar |/opt/puppetlabs/puppet/bin/ruby -rjson -e 'puts (JSON.parse(STDIN.read))[0]["State"]["Running"]') =#{' '}
|test $(podman container inspect --format json namevar |/opt/puppetlabs/puppet/bin/ruby -rjson -e 'puts (JSON.parse(STDIN.read))[0]["State"]["Running"]') = true
END
else
<<-END.gsub(%r{^\s+\|}, '')
|test $(podman container inspect --format json namevar |/usr/bin/ruby -rjson -e 'puts (JSON.parse(STDIN.read))[0]["State"]["Running"]') =#{' '}
|test $(podman container inspect --format json namevar |/usr/bin/ruby -rjson -e 'puts (JSON.parse(STDIN.read))[0]["State"]["Running"]') = true
END
end

Expand Down Expand Up @@ -807,7 +807,7 @@
it { is_expected.to contain_exec('verify_container_image_namevar').with_unless(unless_ruby) }

onlyif_ruby = <<-END.gsub(%r{^\s+\|}, '')
|test $(podman container inspect --format json namevar |/test/ing -rjson -e 'puts (JSON.parse(STDIN.read))[0]["State"]["Running"]') =#{' '}
|test $(podman container inspect --format json namevar |/test/ing -rjson -e 'puts (JSON.parse(STDIN.read))[0]["State"]["Running"]') = true
END

it { is_expected.to contain_exec('podman_remove_container_namevar').with_onlyif(onlyif_ruby) }
Expand All @@ -832,7 +832,7 @@
it { is_expected.to contain_exec('verify_container_image_namevar').with_unless(unless_ruby) }

onlyif_ruby = <<-END.gsub(%r{^\s+\|}, '')
|test $(podman container inspect --format json namevar |/test/ing -rjson -e 'puts (JSON.parse(STDIN.read))[0]["State"]["Running"]') =#{' '}
|test $(podman container inspect --format json namevar |/test/ing -rjson -e 'puts (JSON.parse(STDIN.read))[0]["State"]["Running"]') = true
END

it { is_expected.to contain_exec('podman_remove_container_namevar').with_onlyif(onlyif_ruby) }
Expand Down

0 comments on commit 46fbfc5

Please sign in to comment.