holds.py revision 6d52f363e3b2c0c5da672c5b8c8adec99d345f38
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# CDDL HEADER START
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# The contents of this file are subject to the terms of the
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# Common Development and Distribution License (the "License").
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# You may not use this file except in compliance with the License.
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# See the License for the specific language governing permissions
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# and limitations under the License.
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# When distributing Covered Code, include this CDDL HEADER in each
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# If applicable, add the following below this CDDL HEADER, with the
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# fields enclosed by brackets "[]" replaced with your own identifying
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# information: Portions Copyright [yyyy] [name of copyright owner]
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby# CDDL HEADER END
6d52f363e3b2c0c5da672c5b8c8adec99d345f38Lori Alt# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby"""This module implements the "zfs holds" subcommand.
842727c2f41f01b380de4f5e787d905702870f23Chris KirbyThe only public interface is the zfs.holds.do_holds() function."""
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby """Implements the "zfs holds" subcommand."""
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby u = _("""holds [-r] <snapshot> ...""")
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby parser = optparse.OptionParser(usage=u, prog="zfs")
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby parser.add_option("-r", action="store_true", dest="recursive",
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby (options, args) = parser.parse_args(sys.argv[2:])
842727c2f41f01b380de4f5e787d905702870f23Chris Kirby for ds in zfs.dataset.snapshots_fromcmdline(args, options.recursive):
d7747cbcf0e2da91e8d0e3dfd6d3ac45da469773Chris Kirby raise zfs.util.ZFSError(errno.ENOENT, _("no matching datasets"))