Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def start(cluster_name, cluster):
"""Launches the VMs (vagrant up)
"""
cluster = cluster_name if cluster_name else cluster
if not cluster:
cluster = ss.svars['cluster']
try:
vagrant.cmd(['vagrant', 'up', '--color'], cluster=cluster)
except (ex.LoadError, ex.CreationError) as e:
print_with_color(e.message, 'red')
def status(cluster_name, cluster):
cluster = cluster_name if cluster_name else cluster
if not cluster:
cluster = ss.svars['cluster']
try:
vagrant.cmd(['vagrant', 'status', '--color'], cluster=cluster)
except (ex.LoadError, ex.CreationError) as e:
print_with_color(e.message, 'red')
def stop(cluster_name, cluster):
cluster = cluster_name if cluster_name else cluster
if not cluster:
cluster = ss.svars['cluster']
try:
vagrant.cmd(['vagrant', 'halt', '--color'], cluster=cluster)
except (ex.LoadError, ex.CreationError) as e:
print_with_color(e.message, 'red')
def restart(cluster_name, cluster):
cluster = cluster_name if cluster_name else cluster
if not cluster:
cluster = ss.svars['cluster']
try:
vagrant.cmd(['vagrant', 'halt', '--color'], cluster=cluster)
vagrant.cmd(['vagrant', 'up', '--color'], cluster=cluster)
except (ex.LoadError, ex.CreationError) as e:
print_with_color(e.message, 'red')
def provision(cluster_name, cluster):
cluster = cluster_name if cluster_name else cluster
if not cluster:
cluster = ss.svars['cluster']
try:
vagrant.cmd(['vagrant', 'up', '--provision', '--color'],
cluster=cluster)
except (ex.LoadError, ex.CreationError) as e:
print_with_color(e.message, 'red')