--hard must be explicitly enbled

This commit is contained in:
Joseph Hall 2013-02-08 18:16:51 +00:00
parent cd3ed419bb
commit 7e5000d654
2 changed files with 18 additions and 2 deletions

View File

@ -47,6 +47,14 @@ that exist but are not specified in the map file will be destroyed:
$ salt-cloud -m /path/to/mapfile -P -H
Be careful with this argument, it is very dangerous! In fact, it is so
dangerous that in order to use it, you must explicitly enable it in the main
configuration file.
.. code-block:: yaml
enable_hard_maps: True
A map file can include grains:
.. code-block:: yaml

View File

@ -4,6 +4,7 @@ correct cloud modules
'''
# Import python libs
import os
import sys
import copy
import multiprocessing
import logging
@ -399,8 +400,15 @@ class Map(Cloud):
if prov != 'aws' or pmap['aws'][name]['state'] != 2:
ret['create'].pop(name)
if self.opts['hard']:
# Look for the items to delete
ret['destroy'] = exist.difference(defined)
if self.opts['enable_hard_maps'] is True:
# Look for the items to delete
ret['destroy'] = exist.difference(defined)
else:
print('The --hard map can be extremely dangerous to use, and '
'therefore must explicitly be enabled in the main'
'configuration file, by setting enable_hard_maps to '
'True')
sys.exit(1)
return ret
def run_map(self, dmap):