Merge "Added check of ssl options for nova cells database_connection"
diff --git a/_states/novang.py b/_states/novang.py
index b496117..88cffcb 100644
--- a/_states/novang.py
+++ b/_states/novang.py
@@ -65,10 +65,14 @@
            'changes': {},
            'result': False,
            'comment': 'Cell "{0}" does not exists'.format(name)}
-    cell_uuid = __salt__['cmd.shell']('nova-manage cell_v2 list_cells 2>/dev/null | awk \'/' + name + '/ {print $4}\'')
+    cell_uuid, ssl_enable = (__salt__['cmd.shell']('nova-manage cell_v2 list_cells 2>/dev/null | awk \'/' + name + '/ {print $4, $8}\'')).split(' ', 1)
+    if 'ssl' in ssl_enable:
+        db_options = '?charset=utf8&ssl_ca=/etc/nova/ssl/mysql/ca-cert.pem&ssl_cert=/etc/nova/ssl/mysql/client-cert.pem&ssl_key=/etc/nova/ssl/mysql/client-key.pem'
+    else:
+        db_options = '?charset=utf8'
     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')
+            __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 + db_options + '"')
             ret['result'] = True
             ret['comment'] = 'Cell {0} updated'.format(name)
             ret['changes'][name] = 'Cell {0} successfuly updated'.format(name)