Mend list_cells call
Skip warnings and get required uuid of cell.
Change-Id: Id1fbe42d7c89fbe47e8c50d962f3e6813e1448df
diff --git a/_states/novang.py b/_states/novang.py
index 4ea4094..b496117 100644
--- a/_states/novang.py
+++ b/_states/novang.py
@@ -43,7 +43,7 @@
'changes': {},
'result': False,
'comment': 'Cell "{0}" does not exists'.format(name)}
- cell_uuid = __salt__['cmd.shell']('nova-manage cell_v2 list_cells 2>&- | grep ' + name + ' | tr -d \"\n\" | awk \'{print $4}\'')
+ cell_uuid = __salt__['cmd.shell']('nova-manage cell_v2 list_cells 2>/dev/null | awk \'/' + name + '/ {print $4}\'')
if cell_uuid:
try:
__salt__['cmd.shell']('nova-manage cell_v2 map_instances --cell_uuid ' + cell_uuid)
@@ -65,7 +65,7 @@
'changes': {},
'result': False,
'comment': 'Cell "{0}" does not exists'.format(name)}
- cell_uuid = __salt__['cmd.shell']('nova-manage cell_v2 list_cells 2>&- | grep ' + name + ' | tr -d \"\n\" | awk \'{print $4}\'')
+ cell_uuid = __salt__['cmd.shell']('nova-manage cell_v2 list_cells 2>/dev/null | awk \'/' + name + '/ {print $4}\'')
if cell_uuid:
try:
__salt__['cmd.shell']('nova-manage cell_v2 update_cell --cell_uuid ' + cell_uuid + ' --transport-url ' + transport_url + ' --database_connection ' + db_engine + '+pymysql://' + db_user + ':' + db_password + '@' + db_address + '/' + db_name + '?charset=utf8')
@@ -195,7 +195,7 @@
if zone_exists == False:
item_created = __salt__['novang.availability_zone_create'](name, availability_zone, profile)
if bool(item_created):
- return _created(availability_zone, 'availabilty zone', item_created)
+ return _created(availability_zone, 'availabilty zone', item_created)
else:
return _already_exists(availability_zone, 'availabilty zone')
return existing_availability_zones