Skip to content

Commit

Permalink
Merge branch 'master' into mysql_ssl_connection
Browse files Browse the repository at this point in the history
  • Loading branch information
ngetahun authored Feb 26, 2024
2 parents a00d0f9 + 5e772c3 commit c4a0a35
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ Style/FormatStringToken:

Style/OpenStructUse:
Enabled: false

RSpec/MessageChain:
Enabled: false
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM opensuse/leap:15.3

RUN zypper --non-interactive install --no-recommends \
timezone wget gcc-c++ libffi-devel git-core zlib-devel \
libxml2-devel libxslt-devel cron libmariadb-devel mariadb-client \
libxml2-devel libxslt-devel cron libmariadb-devel mariadb-client sqlite3-devel \
vim ruby2.5 ruby2.5-devel ruby2.5-rubygem-bundler SUSEConnect && \
zypper --non-interactive install -t pattern devel_basis && \
update-alternatives --install /usr/bin/bundle bundle /usr/bin/bundle.ruby2.5 5 && \
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ GEM
minitest (5.15.0)
mixlib-shellout (2.4.4)
mustache (1.1.1)
mysql2 (0.5.5)
mysql2 (0.5.6)
nenv (0.3.0)
nio4r (2.7.0)
nokogiri (1.12.5)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Please view our [guide](docs/installation.md) to assist you in the RMT installat

1. Install the system dependencies:
```
sudo zypper in libxml2-devel libxslt-devel libmariadb-devel gcc
sudo zypper in libxml2-devel libxslt-devel libmariadb-devel sqlite3-devel gcc
```
2. Install the ruby version specified in the `.ruby-version` [file](.ruby-version).
3. Install and setup the database:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ def change
# This migration removes the now obsolete repositories, since RMT does
# not remove these automatically.

# NOTE: We have a check in the repository model to stop users from
# deleting SUSE repositories. This is why need to run delete
# directly rather then destroying as usual.

# Affected repositories are:
# - 1963: https://updates.suse.com/repo/$RCE/RES7/src/
# - 1736: https://updates.suse.com/repo/$RCE/RES7/x86_64/
Repository.where(scc_id: [1963, 1736]).destroy_all
Repository.where(scc_id: [1963, 1736]).delete_all
end
end
2 changes: 1 addition & 1 deletion 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: 2023_08_14_105634) do
ActiveRecord::Schema.define(version: 2024_01_29_140413) do

create_table "activations", charset: "utf8", force: :cascade do |t|
t.bigint "service_id", null: false
Expand Down
5 changes: 4 additions & 1 deletion lib/rmt/lockfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ class RMT::Lockfile

class << self
def lock(lock_name = nil)
yield and return if ActiveRecord::Base.connection.adapter_name != 'Mysql2'
if ActiveRecord::Base.connection.adapter_name != 'Mysql2'
yield
return
end

lock_name = ['rmt-cli', lock_name].compact.join('-')

Expand Down
1 change: 1 addition & 0 deletions package/obs/rmt-server.changes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Thu Feb 08 15:33:00 UTC 2024 - Felix Schnizlein <fschnizlein@suse.com>
* Do not add credential handling to normal repository URLs (bsc#1219153)
* Disable authentication for license files in pubcloud context
* Higher registration sharing timeout
* Provide user/group symbol for user created during pre (boo#1219540)

-------------------------------------------------------------------
Thu Jun 06 15:44:00 UTC 2023 - Luís Caparroz <lcaparroz@suse.com>
Expand Down
1 change: 1 addition & 0 deletions package/obs/rmt-server.spec
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Requires(post): util-linux
Conflicts: yast2-rmt < 1.0.3
Recommends: rmt-server-config
Recommends: yast2-rmt >= 1.3.0
Provides: user(%{rmt_user})
# Does not build for i586 and s390 and is not supported on those architectures
ExcludeArch: %{ix86} s390
%{systemd_ordering}
Expand Down
7 changes: 7 additions & 0 deletions spec/lib/rmt/lockfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,12 @@
)
end
end

context 'with sqlite backend' do
it 'yields block' do
allow(ActiveRecord::Base).to receive_message_chain(:connection, :adapter_name).and_return('sqlite3')
expect(lock).to eq nil
end
end
end
end
2 changes: 0 additions & 2 deletions spec/lib/suse/connect/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
end
end

# rubocop:disable RSpec/MessageChain
describe '#connect_api' do
subject(:method_call) { api_client.send(:connect_api) }

Expand Down Expand Up @@ -77,7 +76,6 @@
end
end
end
# rubocop:enable RSpec/MessageChain

context 'api requests' do
before do
Expand Down
4 changes: 4 additions & 0 deletions spec/support/cli_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ def silence_stdout
def file_human_size(size_in_bytes)
ActiveSupport::NumberHelper.number_to_human_size(size_in_bytes)
end

def running_mysql
ActiveRecord::Base.connection.adapter_name == 'Mysql2'
end
2 changes: 1 addition & 1 deletion spec/support/shared_examples/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
end

shared_examples 'handles lockfile exception' do
context 'with existing lockfile' do
context 'with existing lockfile', if: running_mysql do
before do
allow(RMT::Lockfile).to receive(:obtain_lock).and_return(false)
end
Expand Down

0 comments on commit c4a0a35

Please sign in to comment.