Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates required from testing in public cloud environment #1051

Merged
merged 9 commits into from
Dec 11, 2023
23 changes: 12 additions & 11 deletions db/migrate/20230814105634_move_hw_info_to_systems_table.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
class MoveHwInfoToSystemsTable < ActiveRecord::Migration[6.1]
def up
safety_assured do
execute "update systems as s inner join hw_infos hw on s.id=hw.system_id \
set system_information = json_object(\
'cpus', hw.cpus, \
'sockets', hw.sockets, \
'hypervisor', nullif(hw.hypervisor, ''), \
'arch', nullif(hw.arch, ''), \
'uuid', nullif(hw.uuid, ''), \
'cloud_provider', nullif(hw.cloud_provider, ''));"
change_column :systems, :instance_data, :text

execute "UPDATE systems AS s INNER JOIN hw_infos hw ON s.id=hw.system_id \
SET s.system_information = json_object( \
'cpus', hw.cpus, \
'sockets', hw.sockets, \
'hypervisor', nullif(hw.hypervisor, ''), \
'arch', nullif(hw.arch, ''), \
'uuid', nullif(hw.uuid, ''), \
'cloud_provider', nullif(hw.cloud_provider, '')), \
s.instance_data = hw.instance_data;"
end
end

def down
safety_assured do
execute 'update systems set system_information = json_object();'
end
change_column :systems, :instance_data, :string
end
end
5 changes: 2 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2022_07_11_152732) do
ActiveRecord::Schema.define(version: 2023_08_14_105634) do

create_table "activations", charset: "utf8", force: :cascade do |t|
t.bigint "service_id", null: false
Expand Down Expand Up @@ -51,7 +51,6 @@
t.datetime "updated_at", null: false
t.text "instance_data", comment: "Additional client information, e.g. instance identity document"
t.string "cloud_provider"
t.boolean "proxy_byos", default: false
digitaltom marked this conversation as resolved.
Show resolved Hide resolved
t.index ["hypervisor"], name: "index_hw_infos_on_hypervisor"
t.index ["system_id"], name: "index_hw_infos_on_system_id", unique: true
end
Expand Down Expand Up @@ -163,7 +162,7 @@
t.boolean "proxy_byos", default: false
t.string "system_token"
t.text "system_information", size: :long
t.string "instance_data"
t.text "instance_data"
t.index ["login", "password", "system_token"], name: "index_systems_on_login_and_password_and_system_token", unique: true
t.index ["login", "password"], name: "index_systems_on_login_and_password"
t.check_constraint "json_valid(`system_information`)", name: "system_information"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def destroy
protected

def system_params
params.permit(:login, :password, :hostname, :proxy_byos, :system_token, :registered_at, :created_at, :last_seen_at)
digitaltom marked this conversation as resolved.
Show resolved Hide resolved
params.permit(:login, :password, :hostname, :proxy_byos, :system_token, :registered_at, :created_at, :last_seen_at, :instance_data)
end

def authenticate
Expand Down
5 changes: 5 additions & 0 deletions package/obs/rmt-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ if [ $1 -eq 2 ]; then
mv %{app_dir}/config/system_uuid /var/lib/rmt/system_uuid
fi
bash %{script_dir}/update_rmt_app_dir_permissions.sh %{app_dir}

echo "RMT database migration in progress. This could take some time."
echo ""
echo "To check current migration status:"
echo " systemctl status rmt-server-migration.service"
fi

if [ ! -e %{_datadir}/rmt/public/repo ]; then
Expand Down
Loading