Skip to content

Commit 1384c14

Browse files
committed
NSOL-5942: removing config existence checks
1 parent c476ce4 commit 1384c14

1 file changed

Lines changed: 5 additions & 38 deletions

File tree

netapp_dataops_traditional/netapp_dataops/config/dataset_manager.py

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -204,19 +204,6 @@ def _setup_new_root_volume(self, config: DatasetManagerConfig) -> None:
204204

205205
logger.info(f"\n Setting up new Dataset Manager root volume '{root_volume_name}'...")
206206

207-
# Check if we can connect to ONTAP
208-
from ..traditional.core import _retrieve_config
209-
from ..traditional.exceptions import InvalidConfigError
210-
211-
try:
212-
_retrieve_config(print_output=False)
213-
except (InvalidConfigError, FileNotFoundError):
214-
# Base config doesn't exist yet - defer volume creation
215-
logger.info(f" Note: Cannot create root volume on ONTAP - base configuration not yet complete.")
216-
logger.info(f" Configuration has been saved.")
217-
logger.info(f" Please create the root volume '{root_volume_name}' manually or reconfigure after base setup is complete.")
218-
return
219-
220207
while True: # Loop for retrying with different names if needed
221208
try:
222209
# Check if volume already exists
@@ -266,21 +253,9 @@ def _setup_new_root_volume(self, config: DatasetManagerConfig) -> None:
266253
def _get_volume_info(self, volume_name: str) -> Optional[Dict[str, Any]]:
267254
"""Get volume information from ONTAP.
268255
269-
Returns None if ONTAP connection cannot be established (e.g., during initial config).
256+
Returns None if ONTAP connection cannot be established or volume not found.
270257
"""
271258
try:
272-
# Check if base ONTAP config exists before trying to connect
273-
from ..traditional.core import _retrieve_config
274-
from ..traditional.exceptions import InvalidConfigError
275-
276-
try:
277-
_retrieve_config(print_output=False)
278-
except (InvalidConfigError, FileNotFoundError):
279-
# Base config doesn't exist yet - can't connect to ONTAP
280-
if self.print_output:
281-
logger.info(f" Note: Cannot validate volume on ONTAP - base configuration not yet complete")
282-
return None
283-
284259
# Use list_volumes to find the specific volume
285260
# Always suppress output to avoid displaying volume lists during user input
286261
volumes = volume_operations.list_volumes(print_output=False)
@@ -289,26 +264,18 @@ def _get_volume_info(self, volume_name: str) -> Optional[Dict[str, Any]]:
289264
return volume
290265
return None
291266
except Exception as e:
267+
# Could be a connection error or other issue
268+
# Return None to allow graceful handling by caller
292269
if self.print_output:
293-
logger.info(f" Error retrieving volume information: {e}")
270+
logger.info(f" Note: Could not retrieve volume information: {e}")
294271
return None
295272

296273
def _junction_path_exists(self, junction_path: str, exclude_volume: str = None) -> bool:
297274
"""Check if a junction path is already in use by any volume.
298275
299-
Returns False if ONTAP connection cannot be established.
276+
Returns False if ONTAP connection cannot be established or on error.
300277
"""
301278
try:
302-
# Check if base ONTAP config exists before trying to connect
303-
from ..traditional.core import _retrieve_config
304-
from ..traditional.exceptions import InvalidConfigError
305-
306-
try:
307-
_retrieve_config(print_output=False)
308-
except (InvalidConfigError, FileNotFoundError):
309-
# Base config doesn't exist yet - can't check junction paths
310-
return False
311-
312279
# Always suppress output to avoid displaying volume lists during validation
313280
volumes = volume_operations.list_volumes(print_output=False)
314281
for volume in volumes:

0 commit comments

Comments
 (0)