šŸ” Code Extractor

function check_filecloud_structure

Maturity: 42

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 console 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 intended for diagnostic purposes only and should not be used in production data processing pipelines
  • The function will print sensitive information (server URL, username) to console - use caution in shared environments

Similar Components

AI-powered semantic similarity - components with related functionality:

  • function test_filecloud_connection 74.7% similar

    Tests the connection to a FileCloud server by establishing a client connection and performing a document search operation to verify functionality.

    From: /tf/active/vicechatdev/contract_validity_analyzer/test_implementation.py
  • function test_filecloud_operations 72.9% 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 explore_documents 72.0% similar

    Explores and tests document accessibility across multiple FileCloud directory paths, attempting to download and validate document content from various locations in a hierarchical search pattern.

    From: /tf/active/vicechatdev/contract_validity_analyzer/explore_documents.py
  • function test_filecloud_connection_v1 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_v16 64.5% 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
← Back to Browse