#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
#
#
# Simple function to get the source of the specified property.
# If unable to get the property then exits.
#
{
typeset prop_val
typeset prop=$1
typeset dataset=$2
if [[ $? -ne 0 ]]; then
"property for dataset $dataset"
else
echo $prop_val
fi
}
#
# Function to check the 'source' of a property. The source can
# either be "default", "local", or "inherited from <parent dataset>".
#
# The 'expected src' argument must be either "default", "local", or
# a dataset name.
#
# Returns 0 on success, 1 on failure.
#
{
typeset target=$1
typeset prop=$2
typeset expected=$3
#
# Rather than just checking if $prop_src == $expected
# we first determine what value $expected should have.
# This allows us to catch the case where a property
# has a source of "local" but we expected it to be
# "default"
#
return 1
fi
return 1
fi
" rather than 'inherited from $expected'"
return 1
fi
return 0
}
#
# Simple function to set a property to a
# specified value and verify it has changed
# correctly.
#
{
typeset prop=$1
typeset prop_val=$2
typeset dataset=$3
if [[ $check_val != $prop_val ]]; then
" rather than $prop_val"
fi
}