Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ConnectivityContext
✓ from cloudshell.shell.core.driver_context import ConnectivityContext
✗ from cloudshell.shell.core.context import ConnectivityContext
Correct module is driver_context, not context
ResourceCommandContext
✓ from cloudshell.shell.core.driver_context import ResourceCommandContext
✗ from cloudshell.shell.core.context import ResourceCommandContext
Common mistake: context module renamed to driver_context in v5.1
OrchestrationSaveRestore
✓ from cloudshell.shell.core.orchestration import OrchestrationSaveRestore
Shell
✓ from cloudshell.shell.core.driver_context import Shell
Basic usage to initialize a session and get shell configuration.
from cloudshell.shell.core.driver_context import ResourceCommandContext, ConnectivityContext
from cloudshell.shell.core.configuration import ShellConfiguration
from cloudshell.shell.core.session import Session
# Initialize a session (authentication usually via environment variables)
session = Session(host=os.environ.get('CLOUDSHELL_SERVER', ''),
token=os.environ.get('CLOUDSHELL_TOKEN', ''))
# Get shell configuration
config = ShellConfiguration(session=session, shell_name='MyShell')
print(f'Shell version: {config.shell_version}')
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'cloudshell.shell.core.context'
In v5.1, the context module was renamed to driver_context.
fixUse `from cloudshell.shell.core.driver_context import ...` instead.
TypeError: __init__() got an unexpected keyword argument 'logger'
OrchestrationSaveRestore constructor removed the logger parameter in v6.0.0.
fixRemove the logger argument from OrchestrationSaveRestore() call.
AttributeError: 'ResourceCommandContext' object has no attribute 'reservation'
Reservation context fields changed in newer versions; access via `reservation_context.reservation` or similar.
fixUse the new context attributes: `context.reservation_context.reservation`.
ImportError: cannot import name 'ShellConfiguration' from 'cloudshell.shell.core'
ShellConfiguration may have been moved or removed; use config from cloudshell-core.
fixImport from `cloudshell.core.configuration.ShellConfiguration` or check cloudshell-core package.
Upgrade
Version history
6.0.2latest on PyPI · released Oct 25, 2023
Audit
Dependencies
cloudshell-corerequiredProvides core connectivity and API functionality