Removing optiosn and args pass from state stuff, state stuff doesn't take options or args.
This commit is contained in:
parent
3ddab331f0
commit
01e3dbb05a
2 changed files with 11 additions and 17 deletions
|
@ -389,40 +389,31 @@ class Terraform(object):
|
|||
|
||||
self.tfstate = Tfstate.load_file(file_path)
|
||||
|
||||
def set_workspace(self, workspace=None, dir_or_plan=None, **kwargs):
|
||||
def set_workspace(self, workspace):
|
||||
"""
|
||||
set workspace
|
||||
:param workspace: the desired workspace.
|
||||
:return: status
|
||||
"""
|
||||
|
||||
options = kwargs
|
||||
options = self._generate_default_options(options)
|
||||
args = self._generate_default_args(dir_or_plan)
|
||||
return self.cmd('workspace select ' + workspace, *args, **options)
|
||||
return self.cmd('workspace select ' + workspace)
|
||||
|
||||
def create_workspace(self, workspace=None, dir_or_plan=None, **kwargs):
|
||||
def create_workspace(self, workspace):
|
||||
"""
|
||||
create workspace
|
||||
:param workspace: the desired workspace.
|
||||
:return: status
|
||||
"""
|
||||
|
||||
options = kwargs
|
||||
options = self._generate_default_options(options)
|
||||
args = self._generate_default_args(dir_or_plan)
|
||||
return self.cmd('workspace new ' + workspace, *args, **options)
|
||||
return self.cmd('workspace new ' + workspace)
|
||||
|
||||
def show_workspace(self, dir_or_plan=None, **kwargs):
|
||||
def show_workspace(self):
|
||||
"""
|
||||
show workspace
|
||||
:return: workspace
|
||||
"""
|
||||
|
||||
options = kwargs
|
||||
options = self._generate_default_options(options)
|
||||
args = self._generate_default_args(dir_or_plan)
|
||||
return self.cmd('workspace show', *args, **options)
|
||||
return self.cmd('workspace show')
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
self.temp_var_files.clean_up()
|
||||
|
|
|
@ -323,12 +323,14 @@ class TestTerraform(object):
|
|||
|
||||
def test_create_workspace(self):
|
||||
tf = Terraform(working_dir=current_path)
|
||||
tf.init()
|
||||
ret, out, err = tf.create_workspace('test')
|
||||
assert ret == 0
|
||||
assert err == ''
|
||||
|
||||
def test_set_workspace(self):
|
||||
tf = Terraform(working_dir=current_path)
|
||||
tf.init()
|
||||
tf.create_workspace('test')
|
||||
ret, out, err = tf.set_workspace('test')
|
||||
assert ret == 0
|
||||
|
@ -336,7 +338,8 @@ class TestTerraform(object):
|
|||
|
||||
def test_show_workspace(self):
|
||||
tf = Terraform(working_dir=current_path)
|
||||
tf.init()
|
||||
tf.create_workspace('test')
|
||||
ret, out, err = tf.show_workspace('test')
|
||||
ret, out, err = tf.show_workspace()
|
||||
assert ret == 0
|
||||
assert err == ''
|
Loading…
Reference in a new issue