Class: Pvectl::Commands::CloneContainer
- Inherits:
-
Object
- Object
- Pvectl::Commands::CloneContainer
- Includes:
- SharedConfigParsers
- Defined in:
- lib/pvectl/commands/clone_container.rb
Overview
Handler for the ‘pvectl clone container` command.
Clones a container by CTID, supporting full and linked clones, custom hostname, target node, storage, pool, and description. No batch operations - clones exactly one container at a time.
Class Method Summary collapse
-
.execute(args, options, global_options) ⇒ Integer
Executes the clone container command.
Instance Method Summary collapse
-
#execute ⇒ Integer
Executes the clone container command.
-
#initialize(args, options, global_options) ⇒ CloneContainer
constructor
Initializes a clone container command.
Methods included from SharedConfigParsers
#build_ct_config_params, #build_vm_config_params, #parse_ct_mountpoints, #parse_ct_nets, #parse_vm_cloud_init, #parse_vm_disks, #parse_vm_nets
Constructor Details
#initialize(args, options, global_options) ⇒ CloneContainer
Initializes a clone container command.
38 39 40 41 42 |
# File 'lib/pvectl/commands/clone_container.rb', line 38 def initialize(args, , ) @args = args @options = @global_options = end |
Class Method Details
.execute(args, options, global_options) ⇒ Integer
Executes the clone container command.
29 30 31 |
# File 'lib/pvectl/commands/clone_container.rb', line 29 def self.execute(args, , ) new(args, , ).execute end |
Instance Method Details
#execute ⇒ Integer
Executes the clone container command.
Builds config params from shared flags, validates async+config compatibility, and delegates to the clone operation.
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/pvectl/commands/clone_container.rb', line 50 def execute ctid = @args.first return usage_error("Source CTID required") unless ctid config_params = build_ct_config_params if @options[:async] && !config_params.empty? return usage_error("Config flags require sync mode (remove --async)") end perform_clone(ctid.to_i, config_params) end |