summaryrefslogtreecommitdiff
path: root/designate/manage
diff options
context:
space:
mode:
authorTim Simmons <tim.simmons@rackspace.com>2017-01-30 23:20:36 +0000
committerTim Simmons <tim.simmons@rackspace.com>2017-01-31 02:44:32 +0000
commitf6ba5c29c57e4ee61b131148dc32587cf14be8b2 (patch)
tree0c39a8d0f5188697405b2c6af8b3f3bebcbb80e1 /designate/manage
parent8966e7166b1a5e3dc0df5504de0ba002e2ddf8e5 (diff)
downloaddesignate-f6ba5c29c57e4ee61b131148dc32587cf14be8b2.tar.gz
Use exit code 1 for failed designate-manage pool commands
Ensure that we expose failures for these critical commands and allow automation to know and retry. ``` ...No response received from designate-central. Check it is running, and retry $ echo $? 1 ``` Change-Id: I86fe9e8c7deb13e426ecef88e7da7efaa2373189 Closes-Bug: 1660481
Diffstat (limited to 'designate/manage')
-rw-r--r--designate/manage/pool.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/designate/manage/pool.py b/designate/manage/pool.py
index 38487877..cdeb1bb9 100644
--- a/designate/manage/pool.py
+++ b/designate/manage/pool.py
@@ -13,6 +13,8 @@
# 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 sys
+
import yaml
from oslo_config import cfg
from oslo_log import log as logging
@@ -48,6 +50,7 @@ class PoolCommands(base.Commands):
except messaging.exceptions.MessagingTimeout:
LOG.critical(_LC("No response received from designate-central. "
"Check it is running, and retry"))
+ sys.exit(1)
with open(file, 'w') as stream:
yaml.dump(
DesignateAdapter.render('YAML', pools),
@@ -64,6 +67,7 @@ class PoolCommands(base.Commands):
except messaging.exceptions.MessagingTimeout:
LOG.critical(_LC("No response received from designate-central. "
"Check it is running, and retry"))
+ sys.exit(1)
r_pools = objects.PoolList()
for pool in pools:
r_pool = objects.Pool.from_config(CONF, pool.id)
@@ -93,6 +97,7 @@ class PoolCommands(base.Commands):
except messaging.exceptions.MessagingTimeout:
LOG.critical(_LC("No response received from designate-central. "
"Check it is running, and retry"))
+ sys.exit(1)
@base.args('--file', help='The path to the yaml file describing the pools',
default='/etc/designate/pools.yaml')
@@ -108,7 +113,6 @@ class PoolCommands(base.Commands):
def update(self, file, delete, dry_run):
print('Updating Pools Configuration')
print('****************************')
-
output_msg = ['']
with open(file, 'r') as stream:
@@ -154,6 +158,7 @@ class PoolCommands(base.Commands):
except messaging.exceptions.MessagingTimeout:
LOG.critical(_LC("No response received from designate-central."
" Check it is running, and retry"))
+ sys.exit(1)
if delete:
pools = self.central_api.find_pools(self.context)
@@ -179,6 +184,7 @@ class PoolCommands(base.Commands):
LOG.critical(_LC("No response received from "
"designate-central. "
"Check it is running, and retry"))
+ sys.exit(1)
for line in output_msg:
print(line)