omnibus 6.1.9 → 7.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -109,10 +109,12 @@ module Omnibus
109
109
  let (:s3_access_key) { nil }
110
110
  let (:s3_secret_key) { nil }
111
111
  let (:s3_profile) { nil }
112
+ let (:s3_iam_role_arn) { nil }
112
113
 
113
114
  before do
114
115
  Config.s3_bucket s3_bucket
115
116
  Config.s3_region s3_region
117
+ Config.s3_iam_role_arn s3_iam_role_arn
116
118
  Config.s3_profile s3_profile
117
119
  Config.s3_access_key s3_access_key
118
120
  Config.s3_secret_key s3_secret_key
@@ -148,6 +150,21 @@ module Omnibus
148
150
  expect(config[:secret_access_key]).to eq(nil)
149
151
  end
150
152
  end
153
+
154
+ context "s3_iam_role_arn is configured" do
155
+ let(:s3_iam_role_arn) { "S3_IAM_ROLE_ARN" }
156
+ let(:s3_profile) { "SHAREDPROFILE" }
157
+ let(:s3_access_key) { "ACCESS_KEY_ID" }
158
+ let(:s3_secret_key) { "SECRET_ACCESS_KEY" }
159
+
160
+ it "sets s3_iam_role_arn only" do
161
+ config = S3Cache.send(:s3_configuration)
162
+ expect(config[:iam_role_arn]).to eq(s3_iam_role_arn)
163
+ expect(config[:profile]).to eq(nil)
164
+ expect(config[:access_key_id]).to eq(nil)
165
+ expect(config[:secret_access_key]).to eq(nil)
166
+ end
167
+ end
151
168
  end
152
169
  end
153
170
  end
@@ -40,6 +40,8 @@ module Omnibus
40
40
  let(:instance) { klass.new }
41
41
  let(:key_pair) { { access_key_id: "key_id", secret_access_key: "access_key" } }
42
42
  let(:profile) { "my-profile" }
43
+ let(:iam_role_arn) { "my-iam-role-arn" }
44
+ let(:role_session_name) { "omnibus-assume-role-s3-access" }
43
45
  let(:config) { { bucket_name: "foo", region: "us-east-1" } }
44
46
 
45
47
  it "uses configured key pairs" do
@@ -52,19 +54,36 @@ module Omnibus
52
54
  instance.send(:get_credentials)
53
55
  end
54
56
 
55
- it "preferrs shared credentials profiles over key pairs" do
57
+ it "prefers shared credentials profiles over key pairs" do
56
58
  allow_any_instance_of(klass).to receive(:s3_configuration).and_return(
57
59
  {
58
60
  **config,
59
61
  **key_pair,
62
+ iam_role_arn: nil,
60
63
  profile: profile,
61
64
  }
62
65
  )
63
66
  expect(Aws::Credentials).to_not receive(:new)
67
+ expect(Aws::AssumeRoleCredentials).to_not receive(:new)
64
68
  allow(Aws::SharedCredentials).to receive(:new).with(profile_name: profile)
65
69
  instance.send(:get_credentials)
66
70
  end
67
71
 
72
+ it "prefers AWS IAM role arn over profiles and key pairs" do
73
+ allow_any_instance_of(klass).to receive(:s3_configuration).and_return(
74
+ {
75
+ **config,
76
+ **key_pair,
77
+ profile: profile,
78
+ iam_role_arn: iam_role_arn,
79
+ }
80
+ )
81
+ expect(Aws::Credentials).to_not receive(:new)
82
+ expect(Aws::SharedCredentials).to_not receive(:new)
83
+ allow(Aws::AssumeRoleCredentials).to receive(:new).with(role_arn: iam_role_arn, role_session_name: role_session_name)
84
+ instance.send(:get_credentials)
85
+ end
86
+
68
87
  end
69
88
  end
70
89
  end
@@ -73,9 +73,9 @@ module Omnibus
73
73
  it "sets the defaults" do
74
74
  expect(subject.with_standard_compiler_flags).to eq(
75
75
  "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
76
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
77
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
78
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
76
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
77
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
78
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
79
79
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
80
80
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
81
81
  "OMNIBUS_INSTALL_DIR" => "/opt/project"
@@ -84,9 +84,9 @@ module Omnibus
84
84
  it "overrides LDFLAGS" do
85
85
  expect(subject.with_standard_compiler_flags("LDFLAGS" => "foo")).to eq(
86
86
  "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
87
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
88
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
89
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
87
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
88
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
89
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
90
90
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
91
91
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
92
92
  "OMNIBUS_INSTALL_DIR" => "/opt/project"
@@ -95,9 +95,9 @@ module Omnibus
95
95
  it "overrides CFLAGS" do
96
96
  expect(subject.with_standard_compiler_flags("CFLAGS" => "foo")).to eq(
97
97
  "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
98
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
99
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
100
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
98
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
99
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
100
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
101
101
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
102
102
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
103
103
  "OMNIBUS_INSTALL_DIR" => "/opt/project"
@@ -106,9 +106,9 @@ module Omnibus
106
106
  it "overrides CXXFLAGS" do
107
107
  expect(subject.with_standard_compiler_flags("CXXFLAGS" => "foo")).to eq(
108
108
  "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
109
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
110
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
111
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
109
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
110
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
111
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
112
112
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
113
113
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
114
114
  "OMNIBUS_INSTALL_DIR" => "/opt/project"
@@ -117,9 +117,9 @@ module Omnibus
117
117
  it "overrides CPPFLAGS" do
118
118
  expect(subject.with_standard_compiler_flags("CPPFLAGS" => "foo")).to eq(
119
119
  "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
120
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
121
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
122
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
120
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
121
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
122
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
123
123
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
124
124
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
125
125
  "OMNIBUS_INSTALL_DIR" => "/opt/project"
@@ -129,9 +129,9 @@ module Omnibus
129
129
  expect(subject.with_standard_compiler_flags("numberwang" => 4)).to eq(
130
130
  "numberwang" => 4,
131
131
  "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
132
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
133
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
134
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
132
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
133
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
134
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
135
135
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
136
136
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
137
137
  "OMNIBUS_INSTALL_DIR" => "/opt/project"
@@ -196,9 +196,9 @@ module Omnibus
196
196
  it "sets the defaults" do
197
197
  expect(subject.with_standard_compiler_flags).to eq(
198
198
  "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
199
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
200
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
201
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
199
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
200
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
201
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
202
202
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
203
203
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
204
204
  "OMNIBUS_INSTALL_DIR" => "/opt/project"
@@ -240,9 +240,9 @@ module Omnibus
240
240
  it "sets the defaults" do
241
241
  expect(subject.with_standard_compiler_flags).to eq(
242
242
  "CC" => "clang",
243
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
244
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
245
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
243
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
244
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
245
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
246
246
  "CXX" => "clang++",
247
247
  "LDFLAGS" => "-L/opt/project/embedded/lib",
248
248
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
@@ -267,9 +267,9 @@ module Omnibus
267
267
  expect(subject.with_standard_compiler_flags).to eq(
268
268
  "CC" => "clang",
269
269
  "CXX" => "clang++",
270
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
271
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
272
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
270
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
271
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
272
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
273
273
  "LDFLAGS" => "-L/opt/project/embedded/lib",
274
274
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
275
275
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
@@ -287,9 +287,9 @@ module Omnibus
287
287
  it "sets the defaults" do
288
288
  expect(subject.with_standard_compiler_flags).to eq(
289
289
  "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
290
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
291
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
292
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
290
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
291
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
292
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
293
293
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
294
294
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
295
295
  "OMNIBUS_INSTALL_DIR" => "/opt/project"
@@ -307,9 +307,9 @@ module Omnibus
307
307
  "CC" => "gcc-4.8",
308
308
  "CXX" => "g++-4.8",
309
309
  "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
310
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
311
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
312
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
310
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
311
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
312
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
313
313
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
314
314
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
315
315
  "OMNIBUS_INSTALL_DIR" => "/opt/project"
@@ -328,9 +328,9 @@ module Omnibus
328
328
  it "sets the defaults" do
329
329
  expect(subject.with_standard_compiler_flags).to eq(
330
330
  "LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
331
- "CFLAGS" => "-I/opt/project/embedded/include -O2",
332
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
333
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
331
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
332
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
333
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
334
334
  "LD_RUN_PATH" => "/opt/project/embedded/lib",
335
335
  "PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
336
336
  "OMNIBUS_INSTALL_DIR" => "/opt/project"
@@ -558,6 +558,36 @@ module Omnibus
558
558
  end
559
559
  end
560
560
 
561
+ describe "#bin_dirs" do
562
+ it "sets bin_dirs" do
563
+ subject.bin_dirs ["my_bin_dir"]
564
+ expect(subject.bin_dirs).to eq(["my_bin_dir"])
565
+ expect(subject.bin_dirs).to be_kind_of(Array)
566
+ end
567
+
568
+ context "bin_dirs is not set" do
569
+ it "returns default values" do
570
+ expect(subject.bin_dirs).to eq(["/opt/project/bin", "/opt/project/embedded/bin"])
571
+ expect(subject.bin_dirs).to be_kind_of(Array)
572
+ end
573
+ end
574
+ end
575
+
576
+ describe "#lib_dirs" do
577
+ it "sets lib_dirs" do
578
+ subject.lib_dirs ["my_lib_dir"]
579
+ expect(subject.lib_dirs).to eq(["my_lib_dir"])
580
+ expect(subject.lib_dirs).to be_kind_of(Array)
581
+ end
582
+
583
+ context "lib_dirs is not set" do
584
+ it "returns default values" do
585
+ expect(subject.lib_dirs).to eq(["/opt/project/embedded/lib"])
586
+ expect(subject.lib_dirs).to be_kind_of(Array)
587
+ end
588
+ end
589
+ end
590
+
561
591
  context "testing repo-level version overrides" do
562
592
  context "without overrides" do
563
593
  it "returns the original values" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnibus
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.9
4
+ version: 7.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-31 00:00:00.000000000 Z
11
+ date: 2020-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: chef-sugar-ng
28
+ name: chef-sugar
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ffi
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.13'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.13'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: ffi-yajl
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +109,7 @@ dependencies:
95
109
  version: '13'
96
110
  - - "<"
97
111
  - !ruby/object:Gem::Version
98
- version: '16'
112
+ version: '17'
99
113
  type: :runtime
100
114
  prerelease: false
101
115
  version_requirements: !ruby/object:Gem::Requirement
@@ -105,7 +119,7 @@ dependencies:
105
119
  version: '13'
106
120
  - - "<"
107
121
  - !ruby/object:Gem::Version
108
- version: '16'
122
+ version: '17'
109
123
  - !ruby/object:Gem::Dependency
110
124
  name: ruby-progressbar
111
125
  requirement: !ruby/object:Gem::Requirement
@@ -124,16 +138,22 @@ dependencies:
124
138
  name: thor
125
139
  requirement: !ruby/object:Gem::Requirement
126
140
  requirements:
127
- - - "~>"
141
+ - - ">="
128
142
  - !ruby/object:Gem::Version
129
143
  version: '0.18'
144
+ - - "<"
145
+ - !ruby/object:Gem::Version
146
+ version: '2.0'
130
147
  type: :runtime
131
148
  prerelease: false
132
149
  version_requirements: !ruby/object:Gem::Requirement
133
150
  requirements:
134
- - - "~>"
151
+ - - ">="
135
152
  - !ruby/object:Gem::Version
136
153
  version: '0.18'
154
+ - - "<"
155
+ - !ruby/object:Gem::Version
156
+ version: '2.0'
137
157
  - !ruby/object:Gem::Dependency
138
158
  name: license_scout
139
159
  requirement: !ruby/object:Gem::Requirement
@@ -210,14 +230,14 @@ dependencies:
210
230
  requirements:
211
231
  - - '='
212
232
  - !ruby/object:Gem::Version
213
- version: 0.13.3
233
+ version: 1.1.0
214
234
  type: :development
215
235
  prerelease: false
216
236
  version_requirements: !ruby/object:Gem::Requirement
217
237
  requirements:
218
238
  - - '='
219
239
  - !ruby/object:Gem::Version
220
- version: 0.13.3
240
+ version: 1.1.0
221
241
  - !ruby/object:Gem::Dependency
222
242
  name: fauxhai
223
243
  requirement: !ruby/object:Gem::Requirement