Commit 27e38f02 authored by Alexandre MERLIN's avatar Alexandre MERLIN
Browse files

Move list of supported arch in global config

parent a9695749
Pipeline #262774 passed with stages
in 15 minutes and 30 seconds
......@@ -23,12 +23,6 @@ class Environment
'zstd',
]
ARCH = [
'x86_64',
'aarch64',
'ppc64le',
]
def self.image_type_short(kind,compression)
case kind
when 'tar'
......@@ -208,7 +202,7 @@ class Environment
cp = Configuration::Parser.new(description)
@name = cp.value('name',String)
@version = cp.value('version', Integer,1)
@arch = cp.value('arch', String, nil, ARCH)
@arch = cp.value('arch', String, nil)
@alias = cp.value('alias',String,'')
@description = cp.value('description',String,'')
@author = cp.value('author',String,'')
......
......@@ -222,6 +222,7 @@ module Configuration
attr_reader :secure_client
attr_reader :autoclean_threshold
attr_reader :cmd_ext
attr_reader :archs_list
# Constructor of CommonConfig
#
......@@ -274,7 +275,7 @@ module Configuration
'purge_deployment_timer', Integer, 900
)
end
@archs_list = cp.value('archs_list',String,nil).split(',').collect{ |v| v.strip }.uniq
cp.parse('network',false) do
cp.parse('vlan') do
@vlan_hostname_suffix = cp.value('hostname_suffix',String,'')
......@@ -762,7 +763,7 @@ module Configuration
:type => 'file', :readable => true, :prefix => Config.dir()})
conf = self[clname] = ClusterSpecificConfig.new(
cp.value('prefix',String,''),commonconfig.cmd_ext)
cp.value('prefix',String,''),commonconfig)
return false unless conf.load(clname,clfile)
......@@ -877,7 +878,7 @@ module Configuration
# * nothing
# Output
# * nothing
def initialize(prefix=nil,cmd_ext={})
def initialize(prefix=nil,global_conf)
@prefix = prefix
@workflow_steps = []
@deploy_kernel_args = ""
......@@ -886,8 +887,8 @@ module Configuration
@group_of_nodes = {}
@pxe_header = {}
@use_ip_to_deploy = false
@cmd_ext = cmd_ext.clone
@archs_list = global_conf.archs_list
@cmd_ext = global_conf.cmd_ext.clone
end
def handle_cmd_priority(obj,conf_path,cp,cluster=null,limit=3)
......@@ -1006,10 +1007,10 @@ module Configuration
end
end
cp.parse('arch',true) do
@default_arch = cp.value('default',String,nil,Environment::ARCH)
@default_arch = cp.value('default',String,nil,@archs_list)
@supported_arch = cp.value('supported',String,nil).split(',').collect{ |v| v.strip }.uniq
raise ArgumentError.new("arch/supported must contain arch/default") unless @supported_arch.include?(@default_arch)
unknown_arch = @supported_arch - Environment::ARCH
unknown_arch = @supported_arch - @archs_list
raise ArgumentError.new("Unknown arch #{unknown_arch.join(',')} in arch/supported") unless unknown_arch.empty?
end
cp.parse('boot',true) do
......
......@@ -136,6 +136,10 @@ module Kaenvs
end
def envs_create(cexec)
unless @config.common.archs_list.include?(cexec.environment.arch)
kaerror(APIError::INVALID_ENVIRONMENT,
"The \"#{cexec.environment.arch}\" architecture is unknown. Supported architectures are: #{@config.common.archs_list.join(', ')}")
end
if (envs = cexec.environment.save_to_db(cexec.database)) == true
cexec.environment.to_hash
else
......
......@@ -9,6 +9,7 @@ rights:
purge_deployment_timer: 900
kind: db
almighty_users: root,deploy,vagrant
archs_list: x86_64,ppc64le
authentication:
acl:
whitelist:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment