# SUR 2015/08/20
# Senlin replacing Heat in Magnum
# cluster_function for bay_conductor 

import argparse
import logging
import time

from magnum.common.clients import OpenStackClients as OSC
from magnum.sur.action.clusters import Cluster
from magnum.sur.action.nodes import Node
from magnum.sur.action.profiles import Profile

LOG = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)

def create_cluster(OSC):
    LOG.info('Creating Request accepted.')

    # Client
    sc = OSC.senlin()

    # Create Profile
    pr_master = Profile.profile_create(sc, 'SUR_Master_Profile', 'os.nova.server',
                                '/opt/stack/magnum/magnum/sur/SURspec/SUR_master.spec',
                                '1111')
    pr_minion = Profile.profile_create(sc, 'SUR_Minion_Profile', 'os.nova.server',
                                '/opt/stack/magnum/magnum/sur/SURspec/SUR_minion.spec',
                                '1111')
    time.sleep(1)
    LOG.info(pr)
    
    # Create Cluster
    cr = Cluster.cluster_create(sc, 'SUR_Cluster', 'SUR_Minion_Profile')
    time.sleep(1)
    LOG.info(cr)

    # Create Nodes
    nr_master = Node.node_create(sc, 'SUR_Node_Master', 'SUR_Cluster',
                                 'SUR_Master_Profile')
    time.sleep(1)
    LOG.info(nr_master)

    nr_minion = Node.node_create(sc, 'SUR_Node_Minion', 'SUR_Cluster',
                                 'SUR_Minion_Profile')
    time.sleep(1)
    LOG.info(nr_minion)

    LOG.info('Complete')
    

@@ -232,16 +232,17 @@
 Cluster%0A
+#
 from mag
@@ -1134,24 +1134,25 @@
 e Nodes%0A    
+#
 nr_master = 
@@ -1202,32 +1202,33 @@
 R_Cluster',%0A    
+#
                 
@@ -1258,32 +1258,33 @@
 r_Profile')%0A    
+#
 time.sleep(1)%0A  
@@ -1277,32 +1277,33 @@
 me.sleep(1)%0A    
+#
 LOG.info(nr_mast
@@ -1311,16 +1311,17 @@
 r)%0A%0A    
+#
 nr_minio
@@ -1375,32 +1375,33 @@
 R_Cluster',%0A    
+#
                 
@@ -1431,32 +1431,33 @@
 n_Profile')%0A    
+#
 time.sleep(1)%0A  
@@ -1450,32 +1450,33 @@
 me.sleep(1)%0A    
+#
 LOG.info(nr_mini

modify senlinclusterfunction