File tree Expand file tree Collapse file tree 3 files changed +74
-0
lines changed
config_generator/components/funcs Expand file tree Collapse file tree 3 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 42
42
- func : upload-test-results
43
43
- func : stop-mongo-orchestration
44
44
- func : stop-load-balancer
45
+ - func : restore-instance-profile
45
46
46
47
include :
47
48
- filename : .evergreen/generated_configs/legacy-config.yml
Original file line number Diff line number Diff line change
1
+ from config_generator .etc .function import Function
2
+ from config_generator .etc .utils import bash_exec
3
+
4
+
5
+ class RestoreInstanceProfile (Function ):
6
+ name = 'restore-instance-profile'
7
+ commands = [
8
+ bash_exec (
9
+ script = '''\
10
+ # Restore the AWS Instance Profile that may have been removed in AWS tasks.
11
+
12
+ if [[ ! -d drivers-evergreen-tools ]]; then
13
+ echo "drivers-evergreen-tools not present ... skipping"
14
+ exit 0
15
+ fi
16
+
17
+ cd drivers-evergreen-tools/.evergreen/auth_aws
18
+ if [[ ! -f aws_e2e_setup.json ]]; then
19
+ echo "aws_e2e_setup.json not present ... skipping"
20
+ exit 0
21
+ fi
22
+
23
+ . ./activate-authawsvenv.sh
24
+
25
+ echo "restoring instance profile ... "
26
+ # Capture and hide logs on success. Logs may included expected `HTTP Error 404: Not Found` messages when checking for instance profile.
27
+ if ! { python ./lib/aws_assign_instance_profile.py 2>&1 >|output.txt; }; then
28
+ echo "restoring instance profile ... failed"
29
+ cat output.txt 1>&2
30
+ exit 1
31
+ fi
32
+ echo "restoring instance profile ... succeeded"
33
+ '''
34
+ ),
35
+ ]
36
+
37
+ @classmethod
38
+ def call (cls , ** kwargs ):
39
+ return cls .default_call (** kwargs )
40
+
41
+
42
+ def functions ():
43
+ return RestoreInstanceProfile .defn ()
Original file line number Diff line number Diff line change @@ -285,6 +285,36 @@ functions:
285
285
echo "Cannot append kerberos.realm to /etc/krb5.conf; skipping." 1>&2
286
286
fi
287
287
fi
288
+ restore-instance-profile :
289
+ - command : subprocess.exec
290
+ params :
291
+ binary : bash
292
+ args :
293
+ - -c
294
+ - |
295
+ # Restore the AWS Instance Profile that may have been removed in AWS tasks.
296
+
297
+ if [[ ! -d drivers-evergreen-tools ]]; then
298
+ echo "drivers-evergreen-tools not present ... skipping"
299
+ exit 0
300
+ fi
301
+
302
+ cd drivers-evergreen-tools/.evergreen/auth_aws
303
+ if [[ ! -f aws_e2e_setup.json ]]; then
304
+ echo "aws_e2e_setup.json not present ... skipping"
305
+ exit 0
306
+ fi
307
+
308
+ . ./activate-authawsvenv.sh
309
+
310
+ echo "restoring instance profile ... "
311
+ # Capture and hide logs on success. Logs may included expected `HTTP Error 404: Not Found` messages when checking for instance profile.
312
+ if ! { python ./lib/aws_assign_instance_profile.py 2>&1 >|output.txt; }; then
313
+ echo "restoring instance profile ... failed"
314
+ cat output.txt 1>&2
315
+ exit 1
316
+ fi
317
+ echo "restoring instance profile ... succeeded"
288
318
run-mock-kms-servers :
289
319
- command : subprocess.exec
290
320
type : setup
You can’t perform that action at this time.
0 commit comments