def default_url_options
options = {}
- exturl = URI.parse(Rails.configuration.Services["Controller"]["ExternalURL"])
- options[:host] = exturl.host
- options[:port] = exturl.port
- options[:protocol] = exturl.scheme
+ if Rails.configuration.Services["Controller"]["ExternalURL"] != ""
+ exturl = URI.parse(Rails.configuration.Services["Controller"]["ExternalURL"])
+ options[:host] = exturl.host
+ options[:port] = exturl.port
+ options[:protocol] = exturl.scheme
+ end
options
end
rootUrl: root_url,
servicePath: "arvados/v1/",
batchPath: "batch",
- uuidPrefix: Rails.application.config.ClusterID,
- defaultTrashLifetime: Rails.application.config.Collections["DefaultTrashLifetime"],
- blobSignatureTtl: Rails.application.config.Collections["BlobSigningTTL"],
- maxRequestSize: Rails.application.config.API["MaxRequestSize"],
- maxItemsPerResponse: Rails.application.API["MaxItemsPerResponse"],
- dockerImageFormats: Rails.application.config.Containers["SupportedDockerImageFormats"],
- crunchLogBytesPerEvent: Rails.application.config.Containers["Logging"]["LogBytesPerEvent"],
- crunchLogSecondsBetweenEvents: Rails.application.config.Containers["Logging"]["LogSecondsBetweenEvents"],
- crunchLogThrottlePeriod: Rails.application.config.Containers["Logging"]["LogThrottlePeriod"],
- crunchLogThrottleBytes: Rails.application.config.Containers["Logging"]["LogThrottleBytes"],
- crunchLogThrottleLines: Rails.application.config.Containers["Logging"]["LogThrottleLines"],
- crunchLimitLogBytesPerJob: Rails.application.config.Containers["Logging"]["LimitLogBytesPerJob"],
- crunchLogPartialLineThrottlePeriod: Rails.application.config.Containers["Logging"]["LogPartialLineThrottlePeriod"],
- crunchLogUpdatePeriod: Rails.application.config.Containers["Logging"]["LogUpdatePeriod"],
- crunchLogUpdateSize: Rails.application.config.Containers["Logging"]["LogUpdateSize"],
- remoteHosts: Rails.application.config.RemoteClusters.map {|k,v| v.Host},
- remoteHostsViaDNS: Rails.application.config.RemoteClusters["*"]["Proxy"],
- websocketUrl: Rails.application.config.Services["Websocket"]["ExternalURL"],
- workbenchUrl: Rails.application.config.Services["Workbench1"]["ExternalURL"],
- keepWebServiceUrl: Rails.application.config.Services["WebDAV"]["ExternalURL"],
- gitUrl: Rails.application.config.Services["GitHTTP"]["ExternalURL"],
+ uuidPrefix: Rails.configuration.ClusterID,
+ defaultTrashLifetime: Rails.configuration.Collections["DefaultTrashLifetime"],
+ blobSignatureTtl: Rails.configuration.Collections["BlobSigningTTL"],
+ maxRequestSize: Rails.configuration.API["MaxRequestSize"],
+ maxItemsPerResponse: Rails.configuration.API["MaxItemsPerResponse"],
+ dockerImageFormats: Rails.configuration.Containers["SupportedDockerImageFormats"],
+ crunchLogBytesPerEvent: Rails.configuration.Containers["Logging"]["LogBytesPerEvent"],
+ crunchLogSecondsBetweenEvents: Rails.configuration.Containers["Logging"]["LogSecondsBetweenEvents"],
+ crunchLogThrottlePeriod: Rails.configuration.Containers["Logging"]["LogThrottlePeriod"],
+ crunchLogThrottleBytes: Rails.configuration.Containers["Logging"]["LogThrottleBytes"],
+ crunchLogThrottleLines: Rails.configuration.Containers["Logging"]["LogThrottleLines"],
+ crunchLimitLogBytesPerJob: Rails.configuration.Containers["Logging"]["LimitLogBytesPerJob"],
+ crunchLogPartialLineThrottlePeriod: Rails.configuration.Containers["Logging"]["LogPartialLineThrottlePeriod"],
+ crunchLogUpdatePeriod: Rails.configuration.Containers["Logging"]["LogUpdatePeriod"],
+ crunchLogUpdateSize: Rails.configuration.Containers["Logging"]["LogUpdateSize"],
+ remoteHosts: Rails.configuration.RemoteClusters.map {|k,v| v["Host"]},
+ remoteHostsViaDNS: Rails.configuration.RemoteClusters["*"]["Proxy"],
+ websocketUrl: Rails.configuration.Services["Websocket"]["ExternalURL"],
+ workbenchUrl: Rails.configuration.Services["Workbench1"]["ExternalURL"],
+ keepWebServiceUrl: Rails.configuration.Services["WebDAV"]["ExternalURL"],
+ gitUrl: Rails.configuration.Services["GitHTTP"]["ExternalURL"],
parameters: {
alt: {
type: "string",
if loc = Keep::Locator.parse(search_term)
loc.strip_hints!
coll_match = readable_by(*readers).where(portable_data_hash: loc.to_s).limit(1)
- if coll_match.any? or Rails.configuration.RemoteClusters.length > 1
+ rc = Rails.configuration.RemoteClusters.select{ |k|
+ k != "*" && k != Rails.configuration.ClusterID}
+ if coll_match.any? or rc.length == 0
return get_compatible_images(readers, pattern, coll_match)
else
# Allow bare pdh that doesn't exist in the local database so
end
def find_docker_image_locator
- if runtime_constraints.is_a? Hash
+ if runtime_constraints.is_a? Hash and Rails.configuration.Containers["JobsAPI"]["DefaultDockerImage"] != ""
runtime_constraints['docker_image'] ||=
Rails.configuration.Containers["JobsAPI"]["DefaultDockerImage"]
end
# prefers bare repositories over checkouts.
[["%s.git"], ["%s", ".git"]].each do |repo_base, *join_args|
[:uuid, :name].each do |path_attr|
- git_dir = File.join(Rails.configuration.Containers["Git"]["Repositories"],
+ git_dir = File.join(Rails.configuration.Git["Repositories"],
repo_base % send(path_attr), *join_args)
return git_dir if File.exist?(git_dir)
end
end
def ssh_clone_url
- _clone_url Rails.configuration.Services["GitSSH"]["ExternalURL"], 'git@git.%s.arvadosapi.com:'
+ _clone_url Rails.configuration.Services["GitSSH"].andand["ExternalURL"], 'ssh://git@git.%s.arvadosapi.com'
end
def https_clone_url
- _clone_url Rails.configuration.Services["GitHTTP"]["ExternalURL"], 'https://git.%s.arvadosapi.com/'
+ _clone_url Rails.configuration.Services["GitHTTP"].andand["ExternalURL"], 'https://git.%s.arvadosapi.com/'
end
def _clone_url config_var, default_base_fmt
- configured_base = config_var
+ if not config_var
+ return ""
+ end
prefix = new_record? ? Rails.configuration.ClusterID : uuid[0,5]
- if prefix == Rails.configuration.ClusterID and configured_base != true
- base = configured_base
+ if prefix == Rails.configuration.ClusterID and config_var != URI("")
+ base = config_var
+ else
+ base = URI(default_base_fmt % prefix)
+ end
+ if base.scheme == "ssh"
+ '%s@%s:%s.git' % [base.user, base.host, name]
else
- base = default_base_fmt % prefix
+ '%s%s.git' % [base, name]
end
- '%s%s.git' % [base, name]
end
end
Your Arvados shell account has been set up. Please visit the virtual machines page <% if Rails.configuration.Services["Workbench1"]["ExternalURL"] %>at
- <%= Rails.configuration.Services["Workbench1"]["ExternalURL"] %><%= "/" if !Rails.configuration.Services["Workbench1"]["ExternalURL"].end_with?("/") %>users/<%= @user.uuid%>/virtual_machines <% else %><% end %>
+ <%= Rails.configuration.Services["Workbench1"]["ExternalURL"] %><%= "/" if !Rails.configuration.Services["Workbench1"]["ExternalURL"].to_s.end_with?("/") %>users/<%= @user.uuid%>/virtual_machines <% else %><% end %>
for connection instructions.
end
declare_config "ClusterID", NonemptyString, :uuid_prefix
-declare_config "ManagementToken", NonemptyString, :ManagementToken
+declare_config "ManagementToken", String, :ManagementToken
declare_config "Git.Repositories", String, :git_repositories_dir
declare_config "API.DisabledAPIs", Array, :disable_api_methods
declare_config "API.MaxRequestSize", Integer, :max_request_size
declare_config "Services.Websocket.ExternalURL", URI, :websocket_address
declare_config "Services.WebDAV.ExternalURL", URI, :keep_web_service_url
declare_config "Services.GitHTTP.ExternalURL", URI, :git_repo_https_base
-declare_config "Services.GitSSH.ExternalURL", URI, :git_repo_ssh_base
+declare_config "Services.GitSSH.ExternalURL", URI, :git_repo_ssh_base, ->(cfg, k, v) { set_cfg cfg, "Services.GitSSH.ExternalURL", "ssh://#{v}" }
declare_config "RemoteClusters", Hash, :remote_hosts, ->(cfg, k, v) {
h = {}
v.each do |clusterid, host|
coercion_and_check $arvados_config
Server::Application.configure do
- nils = []
copy_into_config $arvados_config, config
copy_into_config $remaining_config, config
config.secret_key_base = config.secret_token
cfg[k] = ""
end
+ if cfgtype == String and cfg[k].is_a? Symbol
+ cfg[k] = cfg[k].to_s
+ end
+
if cfgtype == NonemptyString
if (!cfg[k] || cfg[k] == "")
raise "#{cfgkey} cannot be empty"
end
def update_node_status
- return unless Server::Application.config.crunch_job_wrapper.to_s.match(/^slurm/)
+ return unless Rails.configuration.Containers["JobsAPI"]["CrunchJobWrapper"].to_s.match(/^slurm/)
slurm_status.each_pair do |hostname, slurmdata|
next if @node_state[hostname] == slurmdata
begin
next if @running[job.uuid]
cmd_args = nil
- case Server::Application.config.crunch_job_wrapper
+ case Rails.configuration.Containers["JobsAPI"]["CrunchJobWrapper"]
when :none
if @running.size > 0
# Don't run more than one at a time.
"--job-name=#{job.uuid}",
"--nodelist=#{nodelist.join(',')}"]
else
- raise "Unknown crunch_job_wrapper: #{Server::Application.config.crunch_job_wrapper}"
+ raise "Unknown crunch_job_wrapper: #{Rails.configuration.Containers["JobsAPI"]["CrunchJobWrapper"]}"
end
cmd_args = sudo_preface + cmd_args
end
def sudo_preface
- return [] if not Server::Application.config.crunch_job_user
+ return [] if not Rails.configuration.Containers["JobsAPI"]["CrunchJobUser"]
["sudo", "-E", "-u",
- Server::Application.config.crunch_job_user,
+ Rails.configuration.Containers["JobsAPI"]["CrunchJobUser"],
"LD_LIBRARY_PATH=#{ENV['LD_LIBRARY_PATH']}",
"PATH=#{ENV['PATH']}",
"PERLLIB=#{ENV['PERLLIB']}",
# An array of job_uuids in squeue
def squeue_jobs
- if Rails.configuration.Containers["JobsAPI"]["CrunchJobWrapper"].to_sym == :slurm_immediate
+ if Rails.configuration.Containers["JobsAPI"]["CrunchJobWrapper"] == "slurm_immediate"
p = IO.popen(['squeue', '-a', '-h', '-o', '%j'])
begin
p.readlines.map {|line| line.strip}
end
def system_user_uuid
- [Server::Application.config.uuid_prefix,
+ [Rails.configuration.ClusterID,
User.uuid_prefix,
'000000000000000'].join('-')
end
def system_group_uuid
- [Server::Application.config.uuid_prefix,
+ [Rails.configuration.ClusterID,
Group.uuid_prefix,
'000000000000000'].join('-')
end
def anonymous_group_uuid
- [Server::Application.config.uuid_prefix,
+ [Rails.configuration.ClusterID,
Group.uuid_prefix,
'anonymouspublic'].join('-')
end
def anonymous_user_uuid
- [Server::Application.config.uuid_prefix,
+ [Rails.configuration.ClusterID,
User.uuid_prefix,
'anonymouspublic'].join('-')
end
end
def all_users_group_uuid
- [Server::Application.config.uuid_prefix,
+ [Rails.configuration.ClusterID,
Group.uuid_prefix,
'fffffffffffffff'].join('-')
end
"jobs.show",
"job_tasks.show"]
- if Rails.configuration.Containers["JobsAPI"]["Enable"] == false ||
+def check_enable_legacy_jobs_api
+ if Rails.configuration.Containers["JobsAPI"]["Enable"] == "false" ||
(Rails.configuration.Containers["JobsAPI"]["Enable"] == "auto" &&
Job.count == 0)
Rails.configuration.API["DisabledAPIs"] += Disable_jobs_api_method_list
Digest::MD5.hexdigest(self.to_s).to_i(16).to_s(36)[-5..-1]
end
def generate_uuid
- [Server::Application.config.uuid_prefix,
+ [Rails.configuration.ClusterID,
self.uuid_prefix,
rand(2**256).to_s(36)[-15..-1]].
join '-'
assert_response 200
c = Collection.find_by_uuid(uuid)
assert_operator c.trash_at, :<, db_current_time
- assert_equal c.delete_at, c.trash_at + Rails.configuration.Collection["BlobSigningTTL"]
+ assert_equal c.delete_at, c.trash_at + Rails.configuration.Collections["BlobSigningTTL"]
end
test 'delete long-trashed collection immediately using http DELETE verb' do
end
[
- {cfg: "Services.GitSSH.ExternalURL", cfgval: "git@example.com:", match: %r"^git@example.com:"},
- {cfg: "Services.GitSSH.ExternalURL", cfgval: true, match: %r"^git@git.zzzzz.arvadosapi.com:"},
- {cfg: "Services.GitSSH.ExternalURL", cfgval: false, refute: /^git@/ },
- {cfg: "Services.GitHTTP.ExternalURL", cfgval: "https://example.com/", match: %r"^https://example.com/"},
- {cfg: "Services.GitHTTP.ExternalURL", cfgval: true, match: %r"^https://git.zzzzz.arvadosapi.com/"},
- {cfg: "Services.GitHTTP.ExternalURL", cfgval: false, refute: /^http/ },
+ {cfg: "GitSSH.ExternalURL", cfgval: URI("ssh://git@example.com"), match: %r"^git@example.com:"},
+ {cfg: "GitSSH.ExternalURL", cfgval: URI(""), match: %r"^git@git.zzzzz.arvadosapi.com:"},
+ {cfg: "GitSSH", cfgval: false, refute: /^git@/ },
+ {cfg: "GitHTTP.ExternalURL", cfgval: URI("https://example.com/"), match: %r"^https://example.com/"},
+ {cfg: "GitHTTP.ExternalURL", cfgval: URI(""), match: %r"^https://git.zzzzz.arvadosapi.com/"},
+ {cfg: "GitHTTP", cfgval: false, refute: /^http/ },
].each do |expect|
test "set #{expect[:cfg]} to #{expect[:cfgval]}" do
- set_cfg Rails.configuration, expect[:cfg].to_s, expect[:cfgval]
+ set_cfg Rails.configuration.Services, expect[:cfg].to_s, expect[:cfgval]
authorize_with :active
get :index
assert_response :success
'ENOEXIST',
'arvados/apitestfixture:ENOEXIST',
].each do |img|
+ puts "RC", Rails.configuration.RemoteClusters
test "container_image_for_container(#{img.inspect}) => 422" do
set_user_from_auth :active
assert_raises(ArvadosModel::UnresolvableContainerError) do
[false, ActiveRecord::RecordInvalid],
[true, nil],
].each do |preemptible_conf, expected|
- test "having Rails.configuration.Containers["UsePreemptibleInstances"]=#{preemptible_conf}, create preemptible container request and verify #{expected}" do
+ test "having Rails.configuration.Containers['UsePreemptibleInstances']=#{preemptible_conf}, create preemptible container request and verify #{expected}" do
sp = {"preemptible" => true}
common_attrs = {cwd: "test",
priority: 1,
[false, 'zzzzz-dz642-runningcontainr', nil],
[false, nil, nil],
].each do |preemptible_conf, requesting_c, schedule_preemptible|
- test "having Rails.configuration.Containers["UsePreemptibleInstances"]=#{preemptible_conf}, #{requesting_c.nil? ? 'non-':''}child CR should #{schedule_preemptible ? '':'not'} ask for preemptible instance by default" do
+ test "having Rails.configuration.Containers['UsePreemptibleInstances']=#{preemptible_conf}, #{requesting_c.nil? ? 'non-':''}child CR should #{schedule_preemptible ? '':'not'} ask for preemptible instance by default" do
common_attrs = {cwd: "test",
priority: 1,
command: ["echo", "hello"],
Rails.configuration.RemoteClusters = {}
job = Job.new job_attrs(runtime_constraints:
{'docker_image' => image_spec})
- assert(job.invalid?, "nonexistent Docker image #{spec_type} was valid")
+ assert(job.invalid?, "nonexistent Docker image #{spec_type} #{image_spec} was valid")
end
end
assert_equal 'Welcome to Arvados - shell account enabled', email.subject
assert (email.body.to_s.include? 'Your Arvados shell account has been set up'),
'Expected Your Arvados shell account has been set up in email body'
- assert (email.body.to_s.include? Rails.configuration.Services["Workbench1"]["ExternalURL"]),
+ assert (email.body.to_s.include? Rails.configuration.Services["Workbench1"]["ExternalURL"].to_s),
'Expected workbench url in email body'
end