Sha256: 4f036c12e155d33cfcdd46ee71cdace3bdc9cc07fd0da60548b5d0f21b2052e7
Contents?: true
Size: 1.46 KB
Versions: 32
Compression:
Stored size: 1.46 KB
Contents
require_relative 'common' module Kontena::Cli::Grids class CreateCommand < Kontena::Command include Kontena::Cli::Common include Common parameter "NAME", "Grid name" option "--initial-size", "INITIAL_SIZE", "Initial grid size (number of nodes)", default: 1 option "--silent", :flag, "Reduce output verbosity" option "--token", "[TOKEN]", "Set grid token" option "--default-affinity", "[AFFINITY]", "Default affinity rule for the grid", multivalued: true option "--subnet", "[CIDR]", "Configure grid overlay subnet" option "--supernet", "[CIDR]", "Configure grid IPAM supernet" requires_current_master_token def execute payload = { name: name } payload[:token] = self.token if self.token payload[:initial_size] = self.initial_size if self.initial_size payload[:default_affinity] = self.default_affinity_list unless self.default_affinity_list.empty? payload[:subnet] = subnet if subnet payload[:supernet] = supernet if supernet grid = nil if initial_size == 1 warning "Option --initial-size=1 is only recommended for test/dev usage" unless running_silent? end spinner "Creating #{pastel.cyan(name)} grid " do grid = client.post('grids', payload) end if grid spinner "Switching scope to #{pastel.cyan(name)} grid " do config.current_grid = grid['name'] config.write end end end end end
Version data entries
32 entries across 32 versions & 1 rubygems