Skip to content

Commit d016c8f

Browse files
sushma-m1mboglesby
authored andcommitted
Pull request #45: Bugfix/fix github issues
Merge in SIE-BB/netapp-dataops-toolkit from bugfix/fix-github-issues to release-v3.1.0 * commit '823767469d90a30d8d05c3f842e89d5c06072406': NSOL-6207: minor correction in tool name NSOL-6244: fixing fstab write failure when /etc/fstab does not exist NSOL-6208: adding support for custom ONTAP API port configuration NSOL-6207: making tool names compatible with Claude Desktop
2 parents e0d0904 + 8237674 commit d016c8f

3 files changed

Lines changed: 44 additions & 9 deletions

File tree

netapp_dataops_traditional/netapp_dataops/config/dataset_manager.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,20 @@ def _add_fstab_entry_safely(self, fstab_entry: str, nfs_target: str, mountpoint:
570570
except Exception as e:
571571
logger.info(f" ERROR: Failed to write temporary file: {e}")
572572
return False
573-
573+
574+
# Step 6b: Create /etc/fstab if it does not exist
575+
if not os.path.exists(fstab_path):
576+
try:
577+
if needs_sudo:
578+
subprocess.run(['sudo', 'touch', fstab_path], check=True,
579+
capture_output=True, text=True)
580+
else:
581+
open(fstab_path, 'w').close()
582+
logger.info(f" Created new /etc/fstab")
583+
except Exception as e:
584+
logger.info(f" ERROR: Failed to create /etc/fstab: {e}")
585+
return False
586+
574587
# Step 7: Execute all operations in a single sudo session if needed
575588
if needs_sudo:
576589
logger.info(" Elevated privileges required to modify /etc/fstab...")

netapp_dataops_traditional/netapp_dataops/mcp_server/netapp_dataops_ontap_mcp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ async def create_flexcache_tool(
489489
raise
490490

491491

492-
@mcp.tool(name="Create CIFS Share")
492+
@mcp.tool(name="CreateCIFSShare")
493493
async def create_cifs_share_tool(
494494
name : str,
495495
volume_name : str,
@@ -540,7 +540,7 @@ async def create_cifs_share_tool(
540540
raise
541541

542542

543-
@mcp.tool(name="List CIFS Shares")
543+
@mcp.tool(name="ListCIFSShares")
544544
async def list_cifs_shares_tool(
545545
svm : Optional[str] = None,
546546
name_pattern : Optional[str] = None,
@@ -601,7 +601,7 @@ async def list_cifs_shares_tool(
601601
raise
602602

603603

604-
@mcp.tool(name="Get CIFS Share")
604+
@mcp.tool(name="GetCIFSShare")
605605
async def get_cifs_share_tool(
606606
name : str,
607607
svm : str,

netapp_dataops_traditional/netapp_dataops/traditional/core/connection.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,38 @@ def _instantiate_connection(config: Dict[str, Any], connectionType: str = "ONTAP
7575

7676
ssl_cert_path = _get_ssl_cert_path(config)
7777

78-
# Security: verify is always True to enforce SSL certificate validation.
79-
# When ssl_cert_path is provided, _apply_custom_ssl_context pins the
80-
# CA cert and relaxes hostname/SAN checks (common for ONTAP self-signed
81-
# certs) while still verifying the certificate chain.
82-
netappConfig.CONNECTION = NetAppHostConnection(
78+
# Extract a custom port if the hostname is in "host:port" format.
79+
# This avoids the double-port URL issue (e.g., host:8001:443) that
80+
# occurs when the ONTAP SDK appends its default port 443 to a hostname
81+
# that already contains a port number.
82+
custom_port = None
83+
if ":" in ontapClusterMgmtHostname:
84+
host_part, port_part = ontapClusterMgmtHostname.rsplit(":", 1)
85+
if port_part.isdigit():
86+
port_num = int(port_part)
87+
if 1 <= port_num <= 65535:
88+
ontapClusterMgmtHostname = host_part
89+
custom_port = port_num
90+
else:
91+
raise InvalidConfigError(
92+
f"Invalid port number '{port_num}' in hostname '{config['hostname']}'. "
93+
"Port must be between 1 and 65535."
94+
)
95+
96+
connection_kwargs = dict(
8397
host=ontapClusterMgmtHostname,
8498
username=ontapClusterAdminUsername,
8599
password=ontapClusterAdminPassword,
86100
verify=True,
87101
)
102+
if custom_port is not None:
103+
connection_kwargs["port"] = custom_port
104+
105+
# Security: verify is always True to enforce SSL certificate validation.
106+
# When ssl_cert_path is provided, _apply_custom_ssl_context pins the
107+
# CA cert and relaxes hostname/SAN checks (common for ONTAP self-signed
108+
# certs) while still verifying the certificate chain.
109+
netappConfig.CONNECTION = NetAppHostConnection(**connection_kwargs)
88110

89111
if ssl_cert_path:
90112
_apply_custom_ssl_context(netappConfig.CONNECTION, ssl_cert_path)

0 commit comments

Comments
 (0)