Skip to content

Commit

Permalink
Merge pull request chef#742 from chef/bp-440/fips-chefdk-omnibus-stunnel
Browse files Browse the repository at this point in the history
Defining fips_enabled? in omnibus
  • Loading branch information
tyler-ball authored Jan 5, 2017
2 parents 712ba4c + 5132274 commit aadc7f2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ gem "pedump", git: "https://github.com/ksubrama/pedump", branch: "patch-1"
# Always use license_scout from master
gem "license_scout", github: "chef/license_scout"

# net-ssh 4.x does not work with Ruby 2.2 on Windows. Chef and ChefDK
# are pinned to 3.2 so pinning that here. Only used by fauxhai in this project
gem "net-ssh", "3.2.0"

group :docs do
gem "yard", "~> 0.8"
gem "redcarpet", "~> 2.2.2"
Expand Down
6 changes: 6 additions & 0 deletions lib/omnibus/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,12 @@ def reset!
:x86
end

# Flag specifying whether the project should be built with FIPS
# compatability or not.
#
# @return [true, false]
default(:fips_mode, false)

# --------------------------------------------------
# @!endgroup
#
Expand Down
4 changes: 4 additions & 0 deletions lib/omnibus/sugarable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,9 @@ module Sugar
def windows_arch_i386?
Config.windows_arch.to_sym == :x86
end

def fips_mode?
!!Config.fips_mode
end
end
end
1 change: 1 addition & 0 deletions spec/unit/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module Omnibus
include_examples "a configurable", :fetcher_read_timeout, 60
include_examples "a configurable", :fetcher_retries, 5
include_examples "a configurable", :fatal_licensing_warnings, false
include_examples "a configurable", :fips_mode, false

describe "#workers" do
context "when the Ohai data is not present" do
Expand Down
22 changes: 21 additions & 1 deletion spec/unit/sugarable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Omnibus
expect(described_class.singleton_class.included_modules).to include(Sugarable)
end

it "includes Sugarable" do
it "is a sugarable" do
expect(described_class.ancestors).to include(Sugarable)
end
end
Expand Down Expand Up @@ -56,4 +56,24 @@ module Omnibus
end
end
end

describe Sugar do
let(:klass) do
Class.new do
include Sugar
end
end

let(:instance) { klass.new }

it "returns the windows architecture being built" do
expect(Omnibus::Config).to receive(:windows_arch).and_return(:x86_64)
expect(instance.windows_arch_i386?).to eq(false)
end

it "returns whether fips_mode is enabled" do
expect(Omnibus::Config).to receive(:fips_mode).and_return(false)
expect(instance.fips_mode?).to eq(false)
end
end
end

0 comments on commit aadc7f2

Please sign in to comment.