File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ Options:
68
68
access to [OPTIONAL].
69
69
-f gcloud filter expression to query disk selection [OPTIONAL]
70
70
-p Prefix to be used for naming snapshots.
71
+ Max character length: 20
71
72
Default if not set: 'gcs' [OPTIONAL]
72
73
-a Service Account to use.
73
74
Blank if not set [OPTIONAL]
@@ -130,13 +131,14 @@ By default snapshots are created with a prefix of `gcs`. To give a custom prefix
130
131
Options:
131
132
132
133
-p Prefix to be used for naming snapshots.
134
+ Max character length: 20
133
135
Default if not set: 'gcs' [OPTIONAL]
134
136
135
137
For example:
136
138
137
139
./gcloud-snapshot.sh -p "my-snap"
138
140
139
- (Note: Snapshot names are limited to 62 characters)
141
+ (Note: Snapshot prefixes are limited to 20 characters)
140
142
141
143
### Service Account
142
144
By default snapshots are created with the default gcloud service account. To use a custom service account use the -a flag:
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ usage() {
28
28
echo -e " access to [OPTIONAL]."
29
29
echo -e " -f gcloud filter expression to query disk selection [OPTIONAL]"
30
30
echo -e " -p Prefix to be used for naming snapshots."
31
+ echo -e " Max character length: 20"
31
32
echo -e " Default if not set: 'gcs' [OPTIONAL]"
32
33
echo -e " -a Service Account to use."
33
34
echo -e " Blank if not set [OPTIONAL]"
@@ -92,7 +93,12 @@ setScriptOptions()
92
93
93
94
# Snapshot Prefix
94
95
if [[ -n $opt_p ]]; then
95
- PREFIX=$opt_p
96
+ # check if prefix is more than 20 chars
97
+ if [ ${# opt_p} -ge 20 ]; then
98
+ PREFIX=${opt_p: 0: 20}
99
+ else
100
+ PREFIX=$opt_p
101
+ fi
96
102
else
97
103
PREFIX=" gcs"
98
104
fi
You can’t perform that action at this time.
0 commit comments