@@ -33,7 +33,6 @@ class ExternalLocations(CrawlerBase[ExternalLocation]):
3333 def __init__ (self , ws : WorkspaceClient , sbe : SqlBackend , schema ):
3434 super ().__init__ (sbe , "hive_metastore" , schema , "external_locations" , ExternalLocation )
3535 self ._ws = ws
36- self ._folder = f"/Users/{ ws .current_user .me ().user_name } /.ucx"
3736
3837 def _external_locations (self , tables : list [Row ], mounts ) -> Iterable [ExternalLocation ]:
3938 min_slash = 2
@@ -173,9 +172,7 @@ def _match_table_external_locations(self) -> tuple[list[list], list[ExternalLoca
173172 missing_locations .append (loc )
174173 return matching_locations , missing_locations
175174
176- def save_as_terraform_definitions_on_workspace (self , folder : str | None = None ) -> str :
177- if folder :
178- self ._folder = folder
175+ def save_as_terraform_definitions_on_workspace (self , folder : str ) -> str | None :
179176 matching_locations , missing_locations = self ._match_table_external_locations ()
180177 if len (matching_locations ) > 0 :
181178 logger .info ("following external locations are already configured." )
@@ -190,13 +187,12 @@ def save_as_terraform_definitions_on_workspace(self, folder: str | None = None)
190187 for script in self ._get_ext_location_definitions (missing_locations ):
191188 buffer .write (script )
192189 buffer .seek (0 )
193- return self ._overwrite_mapping (buffer )
194- else :
195- logger .info ("no additional external location to be created." )
196- return ""
190+ return self ._overwrite_mapping (folder , buffer )
191+ logger .info ("no additional external location to be created." )
192+ return None
197193
198- def _overwrite_mapping (self , buffer ) -> str :
199- path = f"{ self . _folder } /external_locations.tf"
194+ def _overwrite_mapping (self , folder , buffer ) -> str :
195+ path = f"{ folder } /external_locations.tf"
200196 self ._ws .workspace .upload (path , buffer , overwrite = True , format = ImportFormat .AUTO )
201197 return path
202198
0 commit comments