function check_filecloud_structure
Diagnostic function that checks the FileCloud server structure and verifies accessibility of various paths including root, SHARED, and configured base paths.
/tf/active/vicechatdev/SPFCsync/check_filecloud_structure.py
9 - 82
simple
Purpose
This function performs a comprehensive diagnostic check of a FileCloud server installation. It connects to FileCloud using credentials from a Config object, then systematically tests access to common FileCloud paths (root, /SHARED, /SHARED/vicebio_shares, user home directories, etc.) and reports which paths exist and are accessible. This is useful for troubleshooting FileCloud connectivity issues, verifying proper setup before syncing operations, and understanding the available directory structure on a FileCloud instance.
Source Code
def check_filecloud_structure():
"""Check what exists in FileCloud"""
print("š Checking FileCloud Structure")
print("=" * 50)
config = Config()
print(f"š FileCloud Server: {config.FILECLOUD_SERVER_URL}")
print(f"š¤ Username: {config.FILECLOUD_USERNAME}")
print(f"š Configured base path: {config.FILECLOUD_BASE_PATH}")
try:
fc_client = FileCloudClient(
server_url=config.FILECLOUD_SERVER_URL,
username=config.FILECLOUD_USERNAME,
password=config.FILECLOUD_PASSWORD
)
print("ā
Connected to FileCloud")
# Check root level
print(f"\nš Checking root level...")
root_info = fc_client.get_file_info("/")
if root_info:
print(f"ā
Root accessible: {root_info}")
else:
print("ā Cannot access root")
# Check SHARED level
print(f"\nš Checking /SHARED...")
shared_info = fc_client.get_file_info("/SHARED")
if shared_info:
print(f"ā
/SHARED exists: {shared_info}")
else:
print("ā /SHARED does not exist")
# Check vicebio_shares level
print(f"\nš Checking /SHARED/vicebio_shares...")
vicebio_info = fc_client.get_file_info("/SHARED/vicebio_shares")
if vicebio_info:
print(f"ā
/SHARED/vicebio_shares exists: {vicebio_info}")
else:
print("ā /SHARED/vicebio_shares does not exist")
# Check the full base path
print(f"\nš Checking configured base path: {config.FILECLOUD_BASE_PATH}")
base_info = fc_client.get_file_info(config.FILECLOUD_BASE_PATH)
if base_info:
print(f"ā
Base path exists: {base_info}")
else:
print("ā Base path does not exist - it will be created during sync")
# Let's also check what's available in the user's home or typical locations
test_paths = [
"/",
"/Home",
"/SHARED",
"/PUBLIC",
f"/Home/{config.FILECLOUD_USERNAME}",
"/SHARED/vicebio_shares"
]
print(f"\nš Testing common FileCloud paths...")
for path in test_paths:
try:
info = fc_client.get_file_info(path)
if info:
print(f"ā
{path}: {info.get('type', 'unknown')} - {info.get('name', 'unnamed')}")
else:
print(f"ā {path}: Not found")
except Exception as e:
print(f"ā {path}: Error - {e}")
except Exception as e:
print(f"ā Error connecting to FileCloud: {e}")
Return Value
This function does not return any value (implicitly returns None). It outputs diagnostic information directly to stdout using print statements, including connection status, path accessibility results, and any errors encountered during the checks.
Dependencies
filecloud_clientconfig
Required Imports
from filecloud_client import FileCloudClient
from config import Config
Usage Example
# Ensure config.py has FileCloud settings configured
# Example config.py:
# class Config:
# FILECLOUD_SERVER_URL = 'https://filecloud.example.com'
# FILECLOUD_USERNAME = 'myuser'
# FILECLOUD_PASSWORD = 'mypassword'
# FILECLOUD_BASE_PATH = '/SHARED/vicebio_shares/my_folder'
from filecloud_client import FileCloudClient
from config import Config
# Run the diagnostic check
check_filecloud_structure()
# Output will be printed to console showing:
# - Connection status
# - Accessibility of root, /SHARED, and other common paths
# - Information about configured base path
# - Any errors encountered
Best Practices
- Run this function before performing FileCloud sync operations to verify connectivity and path accessibility
- Use this function during initial setup to confirm FileCloud configuration is correct
- Review the output carefully to identify which paths are accessible and which are not
- Ensure Config class is properly configured with valid FileCloud credentials before calling this function
- This function is read-only and safe to run without modifying any FileCloud data
- The function will attempt to create missing base paths during actual sync operations, so missing base path is not necessarily an error
- Consider redirecting output to a log file for troubleshooting purposes in production environments
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
function test_filecloud_operations 72.8% similar
-
function test_filecloud_connection 70.2% similar
-
function main_v11 65.1% similar
-
function test_filecloud_integration 62.8% similar
-
class SyncDiagnostics 61.8% similar