Skip to content

Commit 9134a2d

Browse files
committed
undo change to refresh
1 parent 577227e commit 9134a2d

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/_nebari/stages/terraform_state/__init__.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import contextlib
22
import enum
33
import inspect
4-
import json
54
import os
65
import pathlib
76
import re
8-
import tempfile
97
from typing import Any, Dict, List, Optional, Tuple, Type
108

119
from pydantic import BaseModel, field_validator
@@ -215,7 +213,7 @@ def input_vars(self, stage_outputs: Dict[str, Dict[str, Any]]):
215213
def deploy(
216214
self, stage_outputs: Dict[str, Dict[str, Any]], disable_prompt: bool = False
217215
):
218-
self.check_immutable_fields(stage_outputs)
216+
self.check_immutable_fields()
219217

220218
# No need to run tofu init here as it's being called when running the
221219
# terraform show command, inside check_immutable_fields
@@ -224,8 +222,8 @@ def deploy(
224222
with modified_environ(**env_mapping):
225223
yield
226224

227-
def check_immutable_fields(self, stage_outputs=Dict[str, Dict[str, Any]]):
228-
nebari_config_state = self.get_nebari_config_state(stage_outputs=stage_outputs)
225+
def check_immutable_fields(self):
226+
nebari_config_state = self.get_nebari_config_state()
229227
if not nebari_config_state:
230228
return
231229

@@ -261,18 +259,8 @@ def check_immutable_fields(self, stage_outputs=Dict[str, Dict[str, Any]]):
261259
f'Attempting to change immutable field "{key_path}" ("{old}"->"{new}") in Nebari config file. Immutable fields cannot be changed after initial deployment.'
262260
)
263261

264-
def get_nebari_config_state(self, stage_outputs=Dict[str, Dict[str, Any]]) -> dict:
262+
def get_nebari_config_state(self) -> dict:
265263
directory = str(self.output_directory / self.stage_prefix)
266-
if stage_outputs:
267-
with tempfile.NamedTemporaryFile(
268-
mode="w", encoding="utf-8", suffix=".tfvars.json"
269-
) as f:
270-
input_vars = self.input_vars(stage_outputs)
271-
json.dump(input_vars, f.file)
272-
f.file.flush()
273-
opentofu.refresh(
274-
self.output_directory / self.stage_prefix, var_files=[f.name]
275-
)
276264

277265
tf_state = opentofu.show(directory)
278266
nebari_config_state = None

0 commit comments

Comments
 (0)