Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-install foreman-selinux in acceptance environment #1041

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions spec/setup_acceptance_node.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
}

# Needed for idempotency when SELinux is enabled
if $foreman::repo::configure_scl_repo {
package { 'rh-redis5-redis':
ensure => installed,
if $facts['os']['selinux']['enabled'] {
package { 'foreman-selinux':
ensure => latest,
require => Class['foreman::repo'],
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}

if $foreman::repo::configure_scl_repo {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if $foreman::repo::configure_scl_repo {
if $foreman::repo::configure_scl_repo {

package { 'rh-redis5-redis':
ensure => installed,
require => Class['foreman::repo'],
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole block is indented too far I think. And you'll have a trailing } on line 18.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was my intention to have the rh-redis5-redis package inside if $facts['os']['selinux']['enabled'] { ... } because of the existing comment on L#5: # Needed for idempotency when SELinux is enabled (which now conveniently applies to both package resources)

IMO it was an oversight that this wasn't already conditioned on selinux being enabled.

I thought about making the change in a separate commit but it seemed too minor to warrant it. That would have made this easier to review but probably the git log clutter is not worth it when this only affects tests.

What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works. Can you rebase on latest master branch to ensure tests pass?

}

# Not /etc/foreman because purging removes that
Expand Down
2 changes: 1 addition & 1 deletion spec/support/acceptance/purge.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def purge_foreman
case fact('osfamily')
when 'RedHat'
on default, 'yum -y remove foreman* tfm-*'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a way to exclude a package in yum/dnf remove?

on default, 'rpm -qa | grep -P \'^tfm|^foreman(?!-selinux)\' | xargs yum -y remove'
when 'Debian'
on default, 'apt-get purge -y foreman*', { :acceptable_exit_codes => [0, 100] }
on default, 'apt-get purge -y ruby-hammer-cli-*', { :acceptable_exit_codes => [0, 100] }
Expand Down