diff --git a/python_terraform/__init__.py b/python_terraform/__init__.py index dd0e0d3..468a114 100644 --- a/python_terraform/__init__.py +++ b/python_terraform/__init__.py @@ -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() diff --git a/test/test_terraform.py b/test/test_terraform.py index 1a7d04e..f49be62 100644 --- a/test/test_terraform.py +++ b/test/test_terraform.py @@ -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 == '' \ No newline at end of file + assert err == '' \ No newline at end of file