add_host: check if name or hostname arg is provided

(cherry picked from commit 39d9496282)
pull/36302/head
Martin Krizek 7 years ago committed by Matt Davis
parent eec7945222
commit b546dde48c

@ -48,6 +48,12 @@ class ActionModule(ActionBase):
# Parse out any hostname:port patterns # Parse out any hostname:port patterns
new_name = self._task.args.get('name', self._task.args.get('hostname', self._task.args.get('host', None))) new_name = self._task.args.get('name', self._task.args.get('hostname', self._task.args.get('host', None)))
if new_name is None:
result['failed'] = True
result['msg'] = 'name or hostname arg needs to be provided'
return result
display.vv("creating host via 'add_host': hostname=%s" % new_name) display.vv("creating host via 'add_host': hostname=%s" % new_name)
try: try:

Loading…
Cancel
Save