Skip to content

Commit 22b84ec

Browse files
committed
Add a guard method for setting snapshot labels
1 parent 46c2f02 commit 22b84ec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/fog/compute/google/models/snapshot.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ def destroy(async = true)
3939

4040
def set_labels(new_labels)
4141
requires :identity, :label_fingerprint
42+
43+
unless new_labels.is_a? Hash
44+
raise ArgumentError,
45+
"Labels should be a hash, e.g. {foo: \"bar\",fog: \"test\"}"
46+
end
47+
4248
service.set_snapshot_labels(identity, label_fingerprint, new_labels)
4349
reload
4450
end

0 commit comments

Comments
 (0)