cloudshell-shell-core
raw JSON → 6.0.2 verified Sat May 09 auth: no python
Core package for all CloudShell Shells, providing basic driver interfaces, metadata definitions, utilities, and helpers. Current version: 6.0.2. Released under Apache 2.0, maintained by QualiSystems. Regular releases on PyPI.
pip install cloudshell-shell-core Common errors
error ModuleNotFoundError: No module named 'cloudshell.shell.core.context' ↓
cause In v5.1, the context module was renamed to driver_context.
fix
Use
from cloudshell.shell.core.driver_context import ... instead. error TypeError: __init__() got an unexpected keyword argument 'logger' ↓
cause OrchestrationSaveRestore constructor removed the logger parameter in v6.0.0.
fix
Remove the logger argument from OrchestrationSaveRestore() call.
error AttributeError: 'ResourceCommandContext' object has no attribute 'reservation' ↓
cause Reservation context fields changed in newer versions; access via `reservation_context.reservation` or similar.
fix
Use the new context attributes:
context.reservation_context.reservation. error ImportError: cannot import name 'ShellConfiguration' from 'cloudshell.shell.core' ↓
cause ShellConfiguration may have been moved or removed; use config from cloudshell-core.
fix
Import from
cloudshell.core.configuration.ShellConfiguration or check cloudshell-core package. Warnings
breaking OrchestrationSaveRestore init no longer accepts a logger parameter. Constructor signature changed in v6.0.0. ↓
fix Remove the logger argument from OrchestrationSaveRestore initialization. Use logging.getLogger() separately if needed.
breaking Logging v2 changes: default log_category changed to "cloudshell", and log file prefix always uses resource name (not app name in sandbox). ↓
fix Update any code relying on log file naming or category strings. Use the new logging helper from cloudshell-logging.
gotcha Import paths changed in v5.1: context classes moved from `cloudshell.shell.core.context` to `cloudshell.shell.core.driver_context`. ↓
fix Change imports to use `driver_context` module.
deprecated Python 2 support removed in v6.0.0. ↓
fix Upgrade Python to 3.7+.
Imports
- ConnectivityContext wrong
from cloudshell.shell.core.context import ConnectivityContextcorrectfrom cloudshell.shell.core.driver_context import ConnectivityContext - ResourceCommandContext wrong
from cloudshell.shell.core.context import ResourceCommandContextcorrectfrom cloudshell.shell.core.driver_context import ResourceCommandContext - OrchestrationSaveRestore
from cloudshell.shell.core.orchestration import OrchestrationSaveRestore - Shell
from cloudshell.shell.core.driver_context import Shell
Quickstart
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}')