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
Added a project id option -j so that the script can be run to backup multiple projects without needing to change the gcloud config core.project each time. Here's an example of how we'll be using the feature.
By default snapshots are created with the default gcloud project id. To use a custom project id use the -j flag:
161
+
162
+
Usage: ./gcloud-snapshot.sh [-j <project_id>]
163
+
164
+
Options:
165
+
166
+
-j Project ID to use.
167
+
Blank if not set [OPTIONAL]
168
+
169
+
For example:
170
+
171
+
./gcloud-snapshot.sh -j "my-test-project"
172
+
157
173
### Dry Run
158
174
The script can be run in dry run mode, which doesn't execute any create / delete commands, and prints out debug information.
159
175
@@ -229,4 +245,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
229
245
230
246
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
231
247
232
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
248
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# get list of snapshots from gcloud for this device
236
-
local gcloud_response="$(gcloud $OPT_ACCOUNT compute snapshots list --filter="name~'"$1"' AND creationTimestamp<'$2' AND sourceDiskId='$3'" --uri)"
249
+
local gcloud_response="$(gcloud $OPT_ACCOUNT compute snapshots list --filter="name~'"$1"' AND creationTimestamp<'$2' AND sourceDiskId='$3'" --uri${OPT_PROJECT})"
0 commit comments