šŸ” Code Extractor

function check_filecloud_structure

Maturity: 44

Diagnostic function that checks the FileCloud server structure and verifies accessibility of various paths including root, SHARED, and configured base paths.

File:
/tf/active/vicechatdev/SPFCsync/check_filecloud_structure.py
Lines:
9 - 82
Complexity:
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_client
  • config

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

Similar Components

AI-powered semantic similarity - components with related functionality:

  • function test_filecloud_operations 72.8% similar

    Tests FileCloud basic operations by creating a test folder to verify connectivity and authentication with a FileCloud server.

    From: /tf/active/vicechatdev/SPFCsync/test_connections.py
  • function test_filecloud_connection 70.2% similar

    Tests the connection to a FileCloud server by attempting to instantiate a FileCloudClient with credentials from configuration.

    From: /tf/active/vicechatdev/SPFCsync/test_connections.py
  • function main_v11 65.1% similar

    Executes a diagnostic analysis for file synchronization issues, analyzes missing files, and saves the results to a JSON file.

    From: /tf/active/vicechatdev/SPFCsync/deep_diagnostics.py
  • function test_filecloud_integration 62.8% similar

    Integration test function that verifies the SharePoint Graph API client works correctly with FileCloud synchronization service by creating a sync service instance and testing document retrieval.

    From: /tf/active/vicechatdev/SPFCsync/test_graph_client.py
  • class SyncDiagnostics 61.8% similar

    A diagnostic class that analyzes and reports on synchronization issues between SharePoint and FileCloud, identifying missing files and root causes of sync failures.

    From: /tf/active/vicechatdev/SPFCsync/deep_diagnostics.py
← Back to Browse