Add touch-domain to CLI

Change-Id: I369051e7d7ba2c0819835dada3a13e54798a63ad
This commit is contained in:
Kiall Mac Innes 2013-11-12 12:39:17 +00:00
parent c0c6e59a17
commit 8de6241201
3 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,35 @@
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import logging
from designateclient.cli import base
LOG = logging.getLogger(__name__)
class TouchDomainCommand(base.Command):
""" Touch a single Domain """
def get_parser(self, prog_name):
parser = super(TouchDomainCommand, self).get_parser(prog_name)
parser.add_argument('domain_id', help="Domain ID")
return parser
def execute(self, parsed_args):
self.client.touch.domain(parsed_args.domain_id)
LOG.info('Domain touched sucessfully')

View File

@ -0,0 +1,24 @@
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designateclient.v1.base import Controller
class TouchController(Controller):
def domain(self, domain_id):
"""
Touch a single Domain
"""
self.client.post('/domains/%s/touch' % domain_id)

View File

@ -36,6 +36,7 @@ designateclient.v1.controllers =
records = designateclient.v1.records:RecordsController
servers = designateclient.v1.servers:ServersController
sync = designateclient.v1.sync:SyncController
touch = designateclient.v1.touch:TouchController
designateclient.cli =
domain-list = designateclient.cli.domains:ListDomainsCommand
@ -63,6 +64,8 @@ designateclient.cli =
sync-domain = designateclient.cli.sync:SyncDomainCommand
sync-record = designateclient.cli.sync:SyncRecordCommand
touch-domain = designateclient.cli.touch:TouchDomainCommand
report-count-all = designateclient.cli.reports:CountsCommand
report-count-domains = designateclient.cli.reports:DomainCountCommand
report-count-records = designateclient.cli.reports:RecordCountCommand