Class: ConsoleKit::TenantOrchestrator
- Inherits:
-
Object
- Object
- ConsoleKit::TenantOrchestrator
- Defined in:
- lib/console_kit/tenant_orchestrator.rb
Overview
Orchestrates tenant lifecycle, selection, and configuration
Class Method Summary collapse
- .auto_select? ⇒ Boolean
- .cancel_switch ⇒ Object
- .current_tenant ⇒ Object
- .current_tenant=(val) ⇒ Object
- .reapply ⇒ Object
- .reset ⇒ Object
- .run ⇒ Object
- .select_tenant_key ⇒ Object
- .skip_tenant_message ⇒ Object
- .tenants ⇒ Object
- .tenants? ⇒ Boolean
- .warn_no_tenants ⇒ Object
Class Method Details
.auto_select? ⇒ Boolean
7 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 7 def auto_select? = (tenants.size == 1) || !$stdin.tty? |
.cancel_switch ⇒ Object
42 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 42 def cancel_switch = Output.print_warning('Tenant switch cancelled.') |
.current_tenant ⇒ Object
9 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 9 def current_tenant = Setup.current_tenant |
.current_tenant=(val) ⇒ Object
11 12 13 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 11 def current_tenant=(val) Setup.current_tenant = val end |
.reapply ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 15 def reapply return unless tenant_setup_successful? Output.silence do TenantConfigurator.current_tenant_key = nil TenantConfigurator.configure_tenant(current_tenant) end end |
.reset ⇒ Object
24 25 26 27 28 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 24 def reset return warn_no_tenants unless tenants? perform_reset end |
.run ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 30 def run return if tenant_setup_successful? perform_setup rescue StandardError => e handle_error(e) end |
.select_tenant_key ⇒ Object
40 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 40 def select_tenant_key = auto_select? ? tenants.keys.first : TenantSelector.select |
.skip_tenant_message ⇒ Object
43 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 43 def = Output.print_info('No tenant selected. Loading without tenant configuration.') |
.tenants ⇒ Object
38 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 38 def tenants = ConsoleKit.configuration.tenants |
.tenants? ⇒ Boolean
39 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 39 def tenants? = tenants&.any? |
.warn_no_tenants ⇒ Object
41 |
# File 'lib/console_kit/tenant_orchestrator.rb', line 41 def warn_no_tenants = Output.print_warning('Cannot reset tenant: No tenants configured.') |