Sha256: 8f792391e6cbd62d7bd05b6d862ea6375cbefc1614757c7fb2a59cd89cf683f6
Contents?: true
Size: 966 Bytes
Versions: 34
Compression:
Stored size: 966 Bytes
Contents
module Kontena::Cli::Grids::TrustedSubnets class RemoveCommand < Kontena::Command include Kontena::Cli::Common include Kontena::Cli::GridOptions parameter "SUBNET ...", "Trusted subnet", attribute_name: :subnets option "--force", :flag, "Force remove", default: false, attribute_name: :forced requires_current_master def execute subnets.each do |subnet| grid = client.get("grids/#{current_grid}") confirm_command(subnet) unless forced? trusted_subnets = grid['trusted_subnets'] || [] unless trusted_subnets.delete(subnet) exit_with_error("Grid #{pastel.cyan(current_grid)} does not have trusted subnet #{pastel.cyan(subnet)}") end data = {trusted_subnets: trusted_subnets} spinner "Removing trusted subnet #{pastel.cyan(subnet)} from #{pastel.cyan(current_grid)} grid " do client.put("grids/#{current_grid}", data) end end end end end
Version data entries
34 entries across 34 versions & 2 rubygems