Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Security and Compliance
Policy
Commits
477ca10f
Commit
477ca10f
authored
May 28, 2022
by
Marc Burnie [AWS]
Browse files
Fixing aws bootstrapping
parent
8c0ad4a4
Pipeline
#112294
passed with stages
in 13 minutes and 31 seconds
Changes
2
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
deployment/scripts/aws/AwsPolicyBootstrap.py
View file @
477ca10f
...
...
@@ -32,8 +32,8 @@ DEFAULT_POLICIES = {'legal.rego', 'entitlements.rego',
'dataauthz.rego'
,
'.manifest'
}
# Template paths
DEFAULT_POLICIES_PATH
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
.
replace
(
'scripts
\\
aws'
,
'default-policies'
)
DEFAULT_POLICIES_PATH
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
))
+
'
/
default-policies'
DEFAULT_POLICY_TEMPLATES_PATH
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
'/templates'
DEFAULT_POLICY_CONFIG_MAP_TEMPLATE_PATH
=
os
.
path
.
dirname
(
...
...
@@ -137,12 +137,16 @@ class AwsPolicyBootstrap:
def
upsert_instance_policy_bundle
(
self
,
path
:
str
)
->
None
:
"""Creates a bundle of instance policies given the default bundle path."""
file_list
=
[]
tar_name
=
f
'bundle.tar.gz'
with
tarfile
.
open
(
tar_name
,
"w:gz"
)
as
tar_handle
:
for
root
,
dirs
,
files
in
os
.
walk
(
path
):
for
file
in
files
:
if
file
in
DEFAULT_POLICIES
:
tar_handle
.
add
(
os
.
path
.
join
(
root
,
file
),
arcname
=
file
)
file_list
.
append
(
file
)
self
.
log
.
info
(
f
"Adding files:
{
', '
.
join
(
file_list
)
}
to bundle:
{
tar_name
}
"
)
self
.
_upload_to_policy_bucket
(
tar_name
)
os
.
remove
(
tar_name
)
...
...
deployment/scripts/aws/prepare-dist.sh
View file @
477ca10f
...
...
@@ -28,6 +28,6 @@ rsync deployment/* "${OUTPUT_DIR}/deployment/"
mkdir
-p
"
${
OUTPUT_DIR
}
/deployment/scripts/"
rsync deployment/scripts/
*
"
${
OUTPUT_DIR
}
/deployment/scripts/"
mkdir
-p
"
${
OUTPUT_DIR
}
/deployment/default-policies/"
rsync
deployment/default-policies/
*
"
${
OUTPUT_DIR
}
/deployment/default-policies/"
# Need to use cp since .manifest isn't copied using rsync
cp
-r
deployment/default-policies/
"
${
OUTPUT_DIR
}
/deployment/default-policies/"
cp
-r
deployment/scripts/aws/
"
${
OUTPUT_DIR
}
/deployment/scripts/aws/"
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment