Skip to content

Commit

Permalink
BGBUILD-177: Fedora 13 builds have enabled firewall although they sho…
Browse files Browse the repository at this point in the history
…uldn't have it
  • Loading branch information
goldmann committed Mar 5, 2011
1 parent 0c3fa98 commit 5d42bbb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -6,6 +6,7 @@ v0.9.0
* [BGBUILD-175] Rewrite boxgrinder CLI to remove thor dependency
* [BGBUILD-81] post command execution w/ setarch breaks commands which are scripts
* [BGBUILD-173] Include setarch package in default package list for RPM-based OSes
* [BGBUILD-177] Fedora 13 builds have enabled firewall although they shouldn't have it

v0.8.1

Expand Down
13 changes: 10 additions & 3 deletions lib/boxgrinder-build/plugins/os/rpm-based/rpm-based-os-plugin.rb
Expand Up @@ -91,6 +91,9 @@ def build_with_appliance_creator(appliance_definition_file, repos = {})
apply_root_password(guestfs)
fix_partition_labels(guestfs)
use_labels_for_partitions(guestfs)
disable_firewall(guestfs)
set_motd(guestfs)
install_repos(guestfs)

guestfs.sh("chkconfig firstboot off") if guestfs.exists('/etc/init.d/firstboot') != 0

Expand All @@ -105,9 +108,6 @@ def build_with_appliance_creator(appliance_definition_file, repos = {})
@log.debug "No commands specified, skipping."
end

set_motd(guestfs)
install_repos(guestfs)

yield guestfs, guestfs_helper if block_given?

@log.info "Post operations executed."
Expand All @@ -116,6 +116,13 @@ def build_with_appliance_creator(appliance_definition_file, repos = {})
@log.info "Base image for #{@appliance_config.name} appliance was built successfully."
end

# https://issues.jboss.org/browse/BGBUILD-177
def disable_firewall(guestfs)
@log.debug "Disabling firewall..."
guestfs.sh("lokkit --disabled")
@log.debug "Firewall disabled."
end

def fix_partition_labels(guestfs)
guestfs.list_partitions.each do |partition|
guestfs.sh("/sbin/e2label #{partition} #{read_label(guestfs, partition)}")
Expand Down
1 change: 1 addition & 0 deletions rubygem-boxgrinder-build.spec
Expand Up @@ -144,6 +144,7 @@ popd
- [BGBUILD-175] Rewrite boxgrinder CLI to remove thor dependency
- [BGBUILD-81] post command execution w/ setarch breaks commands which are scripts
- [BGBUILD-173] Include setarch package in default package list for RPM-based OSes
- [BGBUILD-177] Fedora 13 builds have enabled firewall although they shouldn't have it

* Tue Feb 16 2011 <mgoldman@redhat.com> - 0.8.1-1
- Upstream release: 0.8.1
Expand Down
4 changes: 4 additions & 0 deletions spec/helpers/image-helper-spec.rb
Expand Up @@ -55,6 +55,7 @@ module BoxGrinder
@exec_helper.should_receive(:execute).with("losetup -o 0 /dev/loop0 'disk.raw'")
@exec_helper.should_receive(:execute).with('e2label /dev/loop0').and_return('/')
@exec_helper.should_receive(:execute).with("mount /dev/loop0 'mount_dir'")
@helper.should_receive(:sleep).with(2)

@helper.mount_image('disk.raw', 'mount_dir').should == {"/"=>"/dev/loop0"}
end
Expand All @@ -71,6 +72,7 @@ module BoxGrinder

@exec_helper.should_receive(:execute).with("mount /dev/loop1 'mount_dir'")
@exec_helper.should_receive(:execute).with("mount /dev/loop0 'mount_dir/home'")
@helper.should_receive(:sleep).with(2)

@helper.mount_image('disk.raw', 'mount_dir').should == {"/"=>"/dev/loop1", "/home"=>"/dev/loop0"}
end
Expand All @@ -80,6 +82,8 @@ module BoxGrinder
@exec_helper.should_receive(:execute).ordered.with('umount -d /dev/loop1')
FileUtils.should_receive(:rm_rf).with('mount_dir')

@helper.should_receive(:sleep).with(2)

@helper.umount_image('disk.raw', 'mount_dir', {"/"=>"/dev/loop1", "/home"=>"/dev/loop0"})
end

Expand Down
7 changes: 7 additions & 0 deletions spec/plugins/os/rpm-based/rpm-based-os-plugin-spec.rb
Expand Up @@ -150,6 +150,13 @@ module BoxGrinder
@plugin.use_labels_for_partitions(guestfs)
end
end

it "should disable the firewall" do
guestfs = mock("guestfs")
guestfs.should_receive(:sh).with('lokkit --disabled')

@plugin.disable_firewall(guestfs)
end
end
end

0 comments on commit 5d42bbb

Please sign in to comment.