add option for comment on zone creation
This commit is contained in:
parent
9f590234c9
commit
6d40482100
|
@ -14,13 +14,14 @@ help()
|
||||||
echo "$thisfilename"
|
echo "$thisfilename"
|
||||||
echo "Add new zone to DNS"
|
echo "Add new zone to DNS"
|
||||||
echo ""
|
echo ""
|
||||||
echo "usage: $thisfilename -z <zone> [-m <master>] [-t <type>] [-a <account>] [-b] [-h]"
|
echo "usage: $thisfilename -z <zone> [-m <master>] [-t <type>] [-a <account>] [-w <comment>] [-b] [-h]"
|
||||||
echo ""
|
echo ""
|
||||||
echo " -h Print this help."
|
echo " -h Print this help."
|
||||||
echo " -z <zone> Zone (domain name) to add."
|
echo " -z <zone> Zone (domain name) to add."
|
||||||
echo " -m <master> IP address of master, if this zone is of type SLAVE."
|
echo " -m <master> IP address of master, if this zone is of type SLAVE."
|
||||||
echo " -t <type> Defaults to NATIVE. Can also be MASTER or SLAVE. If type is SLAVE be sure to set master IP."
|
echo " -t <type> Defaults to NATIVE. Can also be MASTER or SLAVE. If type is SLAVE be sure to set master IP."
|
||||||
echo " -a <account> The account that controls this zones. For tying in to Control Panel or other custom admins."
|
echo " -a <account> Account that controls this zones. For tying in to Control Panel or other custom admins."
|
||||||
|
echo " -w <comment> Write an optional comment/note. Will be associated with the SOA Resource Record."
|
||||||
echo " -b Bare - create zone without any Resource Records. Normally a default set of RR are created."
|
echo " -b Bare - create zone without any Resource Records. Normally a default set of RR are created."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +79,14 @@ elif [[ $zone_status = 404 ]]; then
|
||||||
data="$data}"
|
data="$data}"
|
||||||
data="$data]"
|
data="$data]"
|
||||||
|
|
||||||
|
# if set add comment, gets associated with SOA
|
||||||
|
if [[ -n $comment ]]; then
|
||||||
|
# set account to hostname if not specified with -a option
|
||||||
|
if [[ -z $account ]]; then
|
||||||
|
account=$(/usr/bin/hostname -f)
|
||||||
|
fi
|
||||||
|
data="$data,\"comments\":[{\"content\":\"$comment\",\"account\":\"$account\"}]"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -n $bare ]]; then
|
if [[ -n $bare ]]; then
|
||||||
# do not add default records
|
# do not add default records
|
||||||
|
@ -154,8 +163,6 @@ elif [[ $zone_status = 404 ]]; then
|
||||||
echo Error. http response adding zone $zone was: $zone_status
|
echo Error. http response adding zone $zone was: $zone_status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "data = $data"
|
|
||||||
|
|
||||||
else
|
else
|
||||||
echo Unexpected http response checking for Zone $zone: $zone_status
|
echo Unexpected http response checking for Zone $zone: $zone_status
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user