Projects
home:rottame:yggdra_agents
dns_authoritative_provisioner
named_zone_info
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File named_zone_info of Package dns_authoritative_provisioner
#!/bin/sh # Source named_env if present if [ -f /etc/dns_authoritative_provisioner/named_env ]; then . /etc/dns_authoritative_provisioner/named_env fi # Set default RNDC_BIN if not set if [ -z "$RNDC_BIN" ]; then RNDC_BIN="/usr/sbin/rndc" fi # Set default RNDC_CONF if not set if [ -z "$RNDC_CONF" ]; then RNDC_CONF="/etc/rndc.conf" fi # Check that exactly one parameter is provided if [ $# -ne 1 ]; then echo "Usage: $0 <zone>" >&2 exit 1 fi ZONE="$1" # Execute rndc zonestatus command and capture output ZONESTATUS_OUTPUT=$("$RNDC_BIN" -c "$RNDC_CONF" zonestatus "$ZONE" 2>&1) EXIT_CODE=$? # If command failed, zone is not configured - output JSON with active: false if [ $EXIT_CODE -ne 0 ]; then echo "{\"zone\":\"$ZONE\",\"active\":false,\"secure\":false,\"dynamic\":false,\"frozen\":false}" exit 0 fi # Parse the output to extract values SECURE=$(echo "$ZONESTATUS_OUTPUT" | grep "^secure:" | sed 's/^secure:[[:space:]]*//') DYNAMIC=$(echo "$ZONESTATUS_OUTPUT" | grep "^dynamic:" | sed 's/^dynamic:[[:space:]]*//') FROZEN=$(echo "$ZONESTATUS_OUTPUT" | grep "^frozen:" | sed 's/^frozen:[[:space:]]*//') # Convert yes/no to boolean if [ "$SECURE" = "yes" ]; then SECURE_BOOL="true" else SECURE_BOOL="false" fi if [ "$DYNAMIC" = "yes" ]; then DYNAMIC_BOOL="true" else DYNAMIC_BOOL="false" fi if [ "$FROZEN" = "yes" ]; then FROZEN_BOOL="true" else FROZEN_BOOL="false" fi # Zone is active if we got here (command succeeded) # Output JSON echo "{\"zone\":\"$ZONE\",\"active\":true,\"secure\":$SECURE_BOOL,\"dynamic\":$DYNAMIC_BOOL,\"frozen\":$FROZEN_BOOL}" exit 0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.