Skip to content

Commit

Permalink
Merge branch 'master' into depfu/update/rack-2.2.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ngetahun authored Feb 25, 2025
2 parents e7781d1 + d54b533 commit c616b92
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 8 deletions.
10 changes: 10 additions & 0 deletions db/migrate/20250121104357_add_regcode_to_systems.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class AddRegcodeToSystems < ActiveRecord::Migration[6.1]
def up
add_column :systems, :pubcloud_reg_code, :string
change_column_default :systems, :pubcloud_reg_code, nil
end

def down
remove_column :systems, :pubcloud_reg_code
end
end
19 changes: 15 additions & 4 deletions engines/instance_verification/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@
module InstanceVerification
class Application < Rails::Application
config.cache_config_file = '/var/lib/rmt/rmt-cache-trim.sh'
config.repo_cache_dir = Rails.root.join('tmp/cache/repository')
repo_cache_base_dir = 'tmp/cache/repository'
config.repo_payg_cache_dir = Rails.root.join("#{repo_cache_base_dir}/payg")
config.repo_byos_cache_dir = Rails.root.join("#{repo_cache_base_dir}/byos")
config.repo_hybrid_cache_dir = Rails.root.join("#{repo_cache_base_dir}/hybrid")
config.registry_cache_dir = Rails.root.join('tmp/cache/registry')
config.expire_repo_payg_cache = 20
config.expire_repo_byos_cache = 1440 # 24h in minutes
config.expire_repo_hybrid_cache = 1440 # 24h in minutes
config.expire_registry_cache = 840 # 8h in minutes
cache_config_content = [
"REPOSITORY_CLIENT_CACHE_DIRECTORY=#{config.repo_cache_dir}",
'REPOSITORY_CACHE_EXPIRY_MINUTES=20',
"REPOSITORY_CLIENT_PAYG_CACHE_DIRECTORY=#{config.repo_payg_cache_dir}",
"REPOSITORY_PAYG_CACHE_EXPIRY_MINUTES=#{config.expire_repo_payg_cache}",
"REPOSITORY_CLIENT_BYOS_CACHE_DIRECTORY=#{config.repo_byos_cache_dir}",
"REPOSITORY_BYOS_CACHE_EXPIRY_MINUTES=#{config.expire_repo_byos_cache}",
"REPOSITORY_CLIENT_HYBRID_CACHE_DIRECTORY=#{config.repo_hybrid_cache_dir}",
"REPOSITORY_HYBRID_CACHE_EXPIRY_MINUTES=#{config.expire_repo_hybrid_cache}",
"REGISTRY_CLIENT_CACHE_DIRECTORY=#{config.registry_cache_dir}",
"REGISTRY_CACHE_EXPIRY_MINUTES=#{Settings[:registry].try(:token_expiration) || 480}" # 480: 8 hours in minutes
"REGISTRY_CACHE_EXPIRY_MINUTES=#{Settings[:registry].try(:token_expiration) || config.expire_registry_cache}" # 480: 8 hours in minutes
].join("\n")
File.write(config.cache_config_file, cache_config_content)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ class RmtToRmtController < ApplicationController

def create
System.transaction do
system = System.find_or_create_by(login: params[:login])
system = System.find_or_create_by(
login: params[:login],
password: params[:password],
system_token: params[:system_token]
)
system.update(system_params)

# TODO: remove this block when proxy_byos column gets dropped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Type=oneshot
Restart=no
Environment="LOG_TO_JOURNALD=1" "LANG=en"
EnvironmentFile=/var/lib/rmt/rmt-cache-trim.sh
ExecStart=find ${REPOSITORY_CLIENT_CACHE_DIRECTORY} -mmin +${REPOSITORY_CACHE_EXPIRY_MINUTES} -type f -delete
ExecStart=find ${REPOSITORY_CLIENT_PAYG_CACHE_DIRECTORY} -mmin +${REPOSITORY_PAYG_CACHE_EXPIRY_MINUTES} -type f -delete
ExecStart=find ${REPOSITORY_CLIENT_BYOS_CACHE_DIRECTORY} -mmin +${REPOSITORY_BYOS_CACHE_EXPIRY_MINUTES} -type f -delete
ExecStart=find ${REPOSITORY_CLIENT_HYBRID_CACHE_DIRECTORY} -mmin +${REPOSITORY_HYBRID_CACHE_EXPIRY_MINUTES} -type f -delete
ExecStart=find ${REGISTRY_CLIENT_CACHE_DIRECTORY} -mmin +${REGISTRY_CACHE_EXPIRY_MINUTES} -type f -delete

[Install]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ module RegistrationSharing

describe '#create byos' do
before do
allow(System).to receive(:find_or_create_by).with(
login: login_byos, password: password, system_token: nil
).and_call_original

post(
'/api/regsharing',
params: {
Expand Down
3 changes: 1 addition & 2 deletions engines/scc_proxy/lib/scc_proxy/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,7 @@ def scc_upgrade
logger.info "Upgrading system to product #{@product.product_string} to SCC"
auth = nil
auth = request.headers['HTTP_AUTHORIZATION'] if request.headers.include?('HTTP_AUTHORIZATION')
mode = 'byos' if @system.byos?
SccProxy.scc_upgrade(auth, @product, @system.login, mode, logger)
SccProxy.scc_upgrade(auth, @product, @system.login, @system.proxy_byos_mode, logger)
logger.info "System #{@system.login} successfully upgraded with SCC"
end

Expand Down
8 changes: 8 additions & 0 deletions package/obs/rmt-server.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Jan 21 10:49:54 UTC 2025 - Jesús Bermúdez Velázquez <jesus.bv@suse.com>

- Version 2.22
* rmt-server-pubcloud:
* Add pubcloud_reg_code column to systems table
* Add cache directories and their expiration times to the scrubber

-------------------------------------------------------------------
Fri Jan 03 10:44:00 UTC 2025 - Luís Caparroz <lcaparroz@suse.com>

Expand Down

0 comments on commit c616b92

Please sign in to comment.