You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Use a check-sleep-check loop to wait for MinIO service to be available
39
39
connectToMinio() {
@@ -61,15 +61,15 @@ data:
61
61
set -e # reset `e` as active
62
62
return 0
63
63
}
64
-
64
+
65
65
# checkBucketExists ($bucket)
66
66
# Check if the bucket exists, by using the exit code of `mc ls`
67
67
checkBucketExists() {
68
68
BUCKET=$1
69
69
CMD=$(${MC} stat myminio/$BUCKET >/dev/null 2>&1)
70
70
return $?
71
71
}
72
-
72
+
73
73
# createBucket ($bucket, $policy, $purge)
74
74
# Ensure bucket exists, purging if asked to
75
75
createBucket() {
@@ -78,7 +78,7 @@ data:
78
78
PURGE=$3
79
79
VERSIONING=$4
80
80
OBJECTLOCKING=$5
81
-
81
+
82
82
# Purge the bucket, if set & exists
83
83
# Since PURGE is user input, check explicitly for `true`
84
84
if [ $PURGE = true ]; then
@@ -91,7 +91,7 @@ data:
91
91
echo "Bucket '$BUCKET' does not exist, skipping purge."
92
92
fi
93
93
fi
94
-
94
+
95
95
# Create the bucket if it does not exist and set objectlocking if enabled (NOTE: versioning will be not changed if OBJECTLOCKING is set because it enables versioning to the Buckets created)
96
96
if ! checkBucketExists $BUCKET; then
97
97
if [ ! -z $OBJECTLOCKING ]; then
@@ -109,7 +109,7 @@ data:
109
109
echo "Bucket '$BUCKET' already exists."
110
110
fi
111
111
fi
112
-
112
+
113
113
# set versioning for bucket if objectlocking is disabled or not set
114
114
if [ $OBJECTLOCKING = false ]; then
115
115
if [ ! -z $VERSIONING ]; then
@@ -124,30 +124,30 @@ data:
124
124
else
125
125
echo "Bucket '$BUCKET' versioning unchanged."
126
126
fi
127
-
127
+
128
128
# At this point, the bucket should exist, skip checking for existence
129
129
# Set policy on the bucket
130
130
echo "Setting policy of bucket '$BUCKET' to '$POLICY'."
131
131
${MC} anonymous set $POLICY myminio/$BUCKET
132
132
}
133
-
133
+
134
134
# Try connecting to MinIO instance
135
135
scheme=https
136
136
connectToMinio $scheme
137
-
137
+
138
138
# Create the buckets
139
139
createBucket demo "public" false false false
140
-
140
+
141
141
add-user: |-
142
142
#!/bin/sh
143
143
set -e ; # Have script exit in the event of a failed command.
0 commit comments