partial client merge
This commit is contained in:
parent
32b0d71693
commit
097bb265e3
@ -24,41 +24,27 @@ class DeployEnvEc2 < DeployEnv
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_subnets d
|
def set_subnets d
|
||||||
if self.networks.nil?
|
|
||||||
get_networks
|
|
||||||
end
|
|
||||||
unless self.options[:subnets].nil?
|
unless self.options[:subnets].nil?
|
||||||
self.options[:subnets] = [ self.options[:subnets][0] ]
|
self.options[:subnets] = [ self.options[:subnets][0] ]
|
||||||
end
|
end
|
||||||
vpc_id = nil
|
vpc_id = nil
|
||||||
set_parameter d, :subnets do
|
set_parameter d, :subnets do
|
||||||
if self.networks.any?
|
networks, networks_table = fetcher.fetch_with_table('network', self.provider)
|
||||||
num = choose_number_from_list(I18n.t("handler.project.create.subnet.ec2"), self.networks, self.networks_table, -1)
|
if networks.any?
|
||||||
vpc_id = self.networks[num]["vpcId"] unless num == -1
|
num = choose_number_from_list(I18n.t("handler.project.create.subnet.ec2"), networks, networks_table, -1)
|
||||||
num == -1 ? [] : [ self.networks[num]["subnetId"] ]
|
vpc_id = networks[num]["vpcId"] unless num == -1
|
||||||
|
num == -1 ? [] : [ networks[num]["subnetId"] ]
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return vpc_id
|
vpc_id
|
||||||
end
|
|
||||||
|
|
||||||
def get_groups vpcId
|
|
||||||
g = Group.new(@host, self.options)
|
|
||||||
g.auth = self.auth
|
|
||||||
p = ["group", "list", provider]
|
|
||||||
p.push vpcId if !vpcId.nil?
|
|
||||||
self.groups = g.list_handler(p)
|
|
||||||
self.groups_table = g.table
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_groups d, vpc_id
|
def set_groups d, vpc_id
|
||||||
if self.groups.nil?
|
|
||||||
get_groups(vpc_id)
|
|
||||||
end
|
|
||||||
set_parameter d, :groups do
|
set_parameter d, :groups do
|
||||||
list = groups.keys
|
groups = resources_selector.select_available_groups(provider: self.provider, vpc_id: vpc_id)
|
||||||
choose_indexes_from_list(I18n.t("options.project.create.groups"), list, self.groups_table, "default", list.index("default")).map{|i| list[i]}
|
groups.map{|t| t['id']}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ require "devops-client/handler/deploy_envs/deploy_env"
|
|||||||
class DeployEnvOpenstack < DeployEnv
|
class DeployEnvOpenstack < DeployEnv
|
||||||
|
|
||||||
NAME = "openstack"
|
NAME = "openstack"
|
||||||
|
attr_accessor :networks, :networks_table
|
||||||
|
|
||||||
def initialize host, options, auth
|
def initialize host, options, auth
|
||||||
@host = host
|
@host = host
|
||||||
@ -24,33 +25,19 @@ class DeployEnvOpenstack < DeployEnv
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_subnets d
|
def set_subnets d
|
||||||
networks, tn = nil, nil
|
|
||||||
if self.networks.nil?
|
|
||||||
get_networks
|
|
||||||
end
|
|
||||||
set_parameter d, :subnets do
|
set_parameter d, :subnets do
|
||||||
s = []
|
s = []
|
||||||
begin
|
begin
|
||||||
s = choose_indexes_from_list(I18n.t("handler.project.create.subnet.openstack"), self.networks, self.networks_table).map{|i| self.networks[i]["name"]}
|
s = resources_selector.select_available_network(table_title: I18n.t("handler.project.create.subnet.openstack"), provider: self.provider)
|
||||||
end while s.empty?
|
end while s.empty?
|
||||||
s
|
s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_groups
|
|
||||||
g = Group.new(@host, self.options)
|
|
||||||
g.auth = self.auth
|
|
||||||
self.groups = g.list_handler(["group", "list", self.provider])
|
|
||||||
self.groups_table = g.table
|
|
||||||
end
|
|
||||||
|
|
||||||
def set_groups d
|
def set_groups d
|
||||||
if self.groups.nil?
|
|
||||||
get_groups
|
|
||||||
end
|
|
||||||
set_parameter d, :groups do
|
set_parameter d, :groups do
|
||||||
list = groups.keys
|
groups = resources_selector.select_available_groups(provider: self.provider)
|
||||||
choose_indexes_from_list(I18n.t("options.project.create.groups"), list, self.groups_table, "default", list.index("default")).map{|i| list[i]}
|
groups.map{|t| t['id']}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -95,4 +95,8 @@ protected
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def current_command
|
||||||
|
ARGV[1].to_sym if ARGV[1]
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -13,7 +13,6 @@ class Key < Handler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def handle
|
def handle
|
||||||
current_command = ARGV[1].to_sym
|
|
||||||
@options, @args = @options_parser.parse_options_for!(current_command)
|
@options, @args = @options_parser.parse_options_for!(current_command)
|
||||||
case current_command
|
case current_command
|
||||||
when :list
|
when :list
|
||||||
|
|||||||
@ -13,7 +13,6 @@ class Server < Handler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def handle
|
def handle
|
||||||
current_command = ARGV[1].to_sym
|
|
||||||
@options, @args = @options_parser.parse_options_for!(current_command)
|
@options, @args = @options_parser.parse_options_for!(current_command)
|
||||||
case current_command
|
case current_command
|
||||||
when :list
|
when :list
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user