Git Product home page Git Product logo

foreman_scc_manager's Introduction

Rubocop Unit Tests Gem Version

Foreman SCC Manager

Foreman plugin to sync SUSE Customer Center products and repositories into Katello.

Installation

This plugin installation is supported since Foreman 3.4 / Katello 4.6 by the foreman-installer, but only with the scenario Katello:

foreman-installer --scenario katello --enable-foreman-plugin-scc-manager

You can also install it manually:

dnf install rubygem-foreman_scc_manager

foreman-installer

Compatibility

Foreman Version Katello Version Plugin Version
3.3 4.5 ~> 2.0.0
3.1 4.3 ~> 1.8.20*
3.0 4.2 ~> 1.8.20
2.5 4.1 ~> 1.8.20
2.3 3.18 ~> 1.8.9
2.1 3.16 ~> 1.8.5
2.0 3.16 ~> 1.8.4
1.24 3.14 ~> 1.8.0

* If you are using foreman_scc_manager in version 1.8.20 and then upgrade to Katello 4.3, you need to manually run the following rake task on your Foreman instance: foreman-rake foreman_scc_manager:setup_authentication_tokens.

Documentation

Plugin documentation

Hammer CLI Extension

Hammer CLI for Foreman SCC Manager

Contributing

Fork and send a Pull Request. Thanks!

Copyright

Copyright (c) 2023 ATIX AG - https://atix.de

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

foreman_scc_manager's People

Contributors

ares avatar bastian-src avatar dgoetz avatar dosas avatar ekohl avatar evgeni avatar hstct avatar klaas- avatar laugmanuel avatar m-bucher avatar manisha15 avatar maximiliankolb avatar mipsou avatar nadjaheitmann avatar prokhorovva avatar quba42 avatar sbernhard avatar tbrisker avatar timogoebel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

foreman_scc_manager's Issues

Description for plugin role

Hi,
in the Foreman we are trying to add descriptions to all roles added from plugins, I would like to ask you kindly if you can add some description to your plugin's role SccManager?

Change is very easy, you can add description as third argument to role function in engine.rb file.

Thank you very much

Not working with foreman-1.16 and Katello-3.5

This plugin cannot subscribe repositories since the parameter number in Glue::Pulp::Repos::add_repo was changed to a single hash item.
Root cause is in /app/lib/actions/scc_manager/subscribe_product.rb

Web application could not be started

ERF73-0602 [Foreman::PermissionMissingException]: some permissions were not found: ["use_scc", "view_scc", "new_scc", "edit_scc", "delete_scc", "sync_scc", :view_scc, :use_scc, :new_scc, :edit_scc, :delete_scc, :sync_scc] (Foreman::PermissionMissingException)

Fresh install CentOS 7.8 - Katello 3.15 - tfm-rubygem-foreman_scc_manager-1.8.3-1.fm2_0.el7

Will there be a new version for Katello 3.15?

Great Job! Thanks a lot!

403 (forbidden) for some SLES-Repos from SCC with Katello 3.18.5 and Foreman 2.3.5

We had this problem first time starting on Oct, 1st 2021 and fixed it on Dec, 17th 2021 after wasting much time with SUSE support but by fixing some Upstream URLs regarding the right (a new!?) "token" for some (5-10) repos. But now we have this problem since May 2dn, 2022 again - but this time for about 80+ SLES-Repos ๐Ÿ˜ข

For example:

Errors:
403, message='Forbidden', url=URL('https://updates.suse.com/SUSE/Products/SLE-Module-Development-Tools/15-SP2/x86_64/product_source/?---token---')

Does anyone else have this problem?
Does anyone know how to fix if effeciently (not by hand!)?
Is the root cause already fixed with a newer Katello version?
Does anyone know if/why SUSE may be changing every 6 months some repo-URLs/tokens?

Fixing the Repo URL with a new/valid token solves this problem. But to get this new URL for each repo one must add another SCC Acount with the same credentials and select (only) the failing ~80+ repos and after waiting until something is finnished: click on them to get the new URL and copy&paste it into the failing repos.

Not working with foreman-1.24.2 and Katello-3.14.1

When synchronizing with SCC through a proxy server, the task fails.

Action:
Actions::SccManager::Sync
Input:
{"scc_account"=>{"id"=>2, "name"=>"suse"},
"repo_status"=>"FAILURE",
"prod_status"=>"FAILURE",
"current_request_id"=>nil,
"current_timezone"=>"USA",
"current_user_id"=>4,
"current_organization_id"=>1,
"current_location_id"=>2}
Output:
{}
Exception:
RuntimeError: Updating failed

Incompartibility with Foreman 1.18

Hi.
Since APIv1 dropped in the Foreman version 1.18 the plugin became unusable.

APIv1 has been deprecated since Foreman 1.9 and Foreman 1.17 is the last version supporting APIv1. We strongly recommend moving to v2 if you are still using v1.

DB migration fails with Foreman 3.3 / Katello 4.5 because of already existing permissions

After installing the plugin, when running the foreman-installer I got an error that foreman-rake db:migrate failed. To reproduce it and provide some clean output I build a new machine.

As you can see I prepared the repos, installed and run the installer. Afterwards I verified the permissions are not present. Then I installed the plugin and another verification already shows the permissions. When I run the migrations now it fails. Deleting the migration seems fine as migrate and seed run fine afterwards as the installer does and from looking into the Roles "SCCViewer" and "SCCManager" I would say it is also fine. So I have no idea why it fails now as it seems like the migration is in for a while and I also do not know how the permissions are created during plugin installation without any scripts or commands executed.

# dnf localinstall https://yum.theforeman.org/releases/3.3/el8/x86_64/foreman-release.rpm -y
# dnf localinstall https://yum.theforeman.org/katello/4.5/katello/el8/x86_64/katello-repos-latest.rpm -y
# dnf localinstall https://yum.puppet.com/puppet7-release-el-8.noarch.rpm -y
# dnf config-manager --set-enabled powertools
# dnf module enable katello:el8 pulpcore:el8 -y
# dnf install foreman-installer-katello -y
# foreman-installer --scenario katello --skip-checks-i-know-better --disable-system-checks
# foreman-rake console
Loading production environment (Rails 6.0.4.7)
irb(main):001:0> Permission.where(resource_type: 'SccAccount')
=> #<ActiveRecord::Relation []>
irb(main):002:0> Permission.where(resource_type: 'SccProduct')
# dnf install rubygem-foreman_scc_manager -y
# foreman-rake console
Loading production environment (Rails 6.0.4.7)
irb(main):001:0> Permission.where(resource_type: 'SccAccount')
=> #<ActiveRecord::Relation [#<Permission id: 224, name: "view_scc_accounts", resource_type: "SccAccount", created_at: "2022-08-18 12:25:23", updated_at: "2022-08-18 12:25:23">, #<Permission id: 225, name: "use_scc_accounts", resource_type: "SccAccount", created_at: "2022-08-18 12:25:23", updated_at: "2022-08-18 12:25:23">, #<Permission id: 226, name: "new_scc_accounts", resource_type: "SccAccount", created_at: "2022-08-18 12:25:23", updated_at: "2022-08-18 12:25:23">, #<Permission id: 227, name: "edit_scc_accounts", resource_type: "SccAccount", created_at: "2022-08-18 12:25:23", updated_at: "2022-08-18 12:25:23">, #<Permission id: 228, name: "delete_scc_accounts", resource_type: "SccAccount", created_at: "2022-08-18 12:25:23", updated_at: "2022-08-18 12:25:23">, #<Permission id: 229, name: "sync_scc_accounts", resource_type: "SccAccount", created_at: "2022-08-18 12:25:23", updated_at: "2022-08-18 12:25:23">, #<Permission id: 230, name: "test_connection_scc_accounts", resource_type: "SccAccount", created_at: "2022-08-18 12:25:23", updated_at: "2022-08-18 12:25:23">]>
irb(main):002:0> Permission.where(resource_type: 'SccProduct')
=> #<ActiveRecord::Relation [#<Permission id: 231, name: "view_scc_products", resource_type: "SccProduct", created_at: "2022-08-18 12:25:23", updated_at: "2022-08-18 12:25:23">, #<Permission id: 232, name: "subscribe_scc_products", resource_type: "SccProduct", created_at: "2022-08-18 12:25:23", updated_at: "2022-08-18 12:25:23">]>
# foreman-rake db:migrate
== 20170221100619 CreateSccAccounts: migrating ================================
-- create_table(:scc_accounts, {:id=>:integer})
   -> 0.0125s
== 20170221100619 CreateSccAccounts: migrated (0.0126s) =======================

== 20170227103408 CreateSccProducts: migrating ================================
-- create_table(:scc_products, {:id=>:integer})
   -> 0.0137s
== 20170227103408 CreateSccProducts: migrated (0.0138s) =======================

== 20170301131641 CreateSccRepositories: migrating ============================
-- create_table(:scc_repositories, {:id=>:integer})
   -> 0.0134s
== 20170301131641 CreateSccRepositories: migrated (0.0135s) ===================

== 20170301141330 CreateSccProductsSccRepositoriesJoinTable: migrating ========
-- create_join_table(:scc_products, :scc_repositories, {:column_options=>{:type=>:integer}})
   -> 0.0010s
== 20170301141330 CreateSccProductsSccRepositoriesJoinTable: migrated (0.0011s) 

== 20170301163451 AddProductTypeToSccProduct: migrating =======================
-- add_column(:scc_products, :product_type, :string, {:limit=>63})
   -> 0.0004s
== 20170301163451 AddProductTypeToSccProduct: migrated (0.0005s) ==============

== 20170302082912 RemoveRepositoriesFromSccProducts: migrating ================
-- remove_column(:scc_products, :repositories, :string)
   -> 0.0006s
== 20170302082912 RemoveRepositoriesFromSccProducts: migrated (0.0006s) =======

== 20170302121542 CreateSccExtendings: migrating ==============================
-- create_table(:scc_extendings, {:id=>:integer})
   -> 0.0159s
-- add_foreign_key(:scc_extendings, :scc_products, {:column=>:scc_product_id})
   -> 0.0007s
-- add_foreign_key(:scc_extendings, :scc_products, {:column=>:scc_extension_id})
   -> 0.0007s
== 20170302121542 CreateSccExtendings: migrated (0.0173s) =====================

== 20170303085304 AddOrganizationToSccAccount: migrating ======================
-- add_column(:scc_accounts, :organization_id, :integer, {:null=>true, :index=>true})
   -> 0.0005s
-- change_column(:scc_accounts, :organization_id, :integer, {:index=>true})
   -> 0.0003s
== 20170303085304 AddOrganizationToSccAccount: migrated (0.0026s) =============

== 20170303131704 AddProductIdToSccProduct: migrating =========================
-- add_column(:scc_products, :product_id, :integer, {:index=>true, :null=>true})
   -> 0.0004s
-- add_foreign_key(:scc_products, :katello_products, {:column=>:product_id, :on_delete=>:nullify})
   -> 0.0009s
== 20170303131704 AddProductIdToSccProduct: migrated (0.0013s) ================

== 20170307092057 AddSyncedToSccAccount: migrating ============================
-- add_column(:scc_accounts, :synced, :datetime, {:default=>nil})
   -> 0.0005s
== 20170307092057 AddSyncedToSccAccount: migrated (0.0005s) ===================

== 20170418132648 AddNameToSccAccount: migrating ==============================
-- add_column(:scc_accounts, :name, :string, {:limit=>255})
   -> 0.0003s
== 20170418132648 AddNameToSccAccount: migrated (0.0003s) =====================

== 20170505063726 AddSyncStatusToSccAccount: migrating ========================
-- add_column(:scc_accounts, :sync_status, :string, {})
   -> 0.0004s
== 20170505063726 AddSyncStatusToSccAccount: migrated (0.0004s) ===============

== 20180321000000 ChangeSyncStatusToSyncTask: migrating =======================
-- remove_column(:scc_accounts, :sync_status, :string)
   -> 0.0004s
-- add_column(:scc_accounts, :sync_task_id, :uuid, {:null=>true})
   -> 0.0002s
== 20180321000000 ChangeSyncStatusToSyncTask: migrated (0.0007s) ==============

== 20190417202427 AddRecurringSync: migrating =================================
-- add_column(:scc_accounts, :foreman_tasks_recurring_logic_id, :integer)
   -> 0.0003s
-- add_column(:scc_accounts, :interval, :string, {:default=>"never"})
   -> 0.0003s
-- add_column(:scc_accounts, :sync_date, :datetime)
   -> 0.0001s
-- add_foreign_key(:scc_accounts, :foreman_tasks_recurring_logics, {:name=>"scc_accounts_foreman_tasks_recurring_logic_fk", :column=>"foreman_tasks_recurring_logic_id"})
   -> 0.0008s
-- add_column(:scc_accounts, :task_group_id, :integer, {:index=>true})
   -> 0.0001s
-- add_foreign_key(:scc_accounts, :foreman_tasks_task_groups, {:column=>:task_group_id})
   -> 0.0005s
== 20190417202427 AddRecurringSync: migrated (0.0029s) ========================

== 20200520281300 FixSccPermissions: migrating ================================
== 20200520281300 FixSccPermissions: migrated (0.0060s) =======================

== 20201119084201 AddGpgKeyToSccAccount: migrating ============================
-- add_column(:scc_accounts, :katello_gpg_key_id, :integer, {:null=>true})
   -> 0.0005s
-- add_foreign_key(:scc_accounts, :katello_content_credentials, {:column=>:katello_gpg_key_id, :on_delete=>:nullify})
   -> 0.0014s
== 20201119084201 AddGpgKeyToSccAccount: migrated (0.0025s) ===================

== 20210205082733 AddSubscriptionValidToSccProductsAndRepos: migrating ========
-- add_column(:scc_products, :subscription_valid, :boolean, {:null=>true})
   -> 0.0004s
-- add_column(:scc_repositories, :subscription_valid, :boolean, {:null=>true})
   -> 0.0002s
== 20210205082733 AddSubscriptionValidToSccProductsAndRepos: migrated (0.0007s) 

== 20210210104407 AddRootRepositoryIdToSccRepository: migrating ===============
-- add_column(:scc_repositories, :katello_root_repository_id, :integer, {:index=>true, :null=>true})
   -> 0.0003s
-- add_foreign_key(:scc_repositories, :katello_root_repositories, {:column=>:katello_root_repository_id, :on_delete=>:nullify})
   -> 0.0008s
== 20210210104407 AddRootRepositoryIdToSccRepository: migrated (0.0012s) ======

== 20210224095050 ConnectKatelloRootRepositoryToSccRepository: migrating ======
== 20210224095050 ConnectKatelloRootRepositoryToSccRepository: migrated (0.0021s) 

== 20210713092440 AddPermissions: migrating ===================================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Validation failed: Name has already been taken
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/validations.rb:80:in `raise_validation_error'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/validations.rb:53:in `save!'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:318:in `block in save!'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:375:in `block in with_transaction_returning_status'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/database_statements.rb:278:in `transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:318:in `save!'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/suppressor.rb:48:in `save!'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/persistence.rb:55:in `create!'
/usr/share/gems/gems/foreman_scc_manager-1.8.20/db/migrate/20210713092440_add_permissions.rb:8:in `up'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:831:in `exec_migration'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:811:in `block in migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:810:in `migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1002:in `migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1361:in `ddl_transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1280:in `each'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1280:in `migrate_without_lock'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1229:in `block in migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1382:in `with_advisory_lock'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1229:in `migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1061:in `up'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1036:in `migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/railties/databases.rake:84:in `each'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'
/usr/share/gems/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'

Caused by:
ActiveRecord::RecordInvalid: Validation failed: Name has already been taken
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/validations.rb:80:in `raise_validation_error'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/validations.rb:53:in `save!'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:318:in `block in save!'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:375:in `block in with_transaction_returning_status'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/database_statements.rb:278:in `transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:318:in `save!'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/suppressor.rb:48:in `save!'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/persistence.rb:55:in `create!'
/usr/share/gems/gems/foreman_scc_manager-1.8.20/db/migrate/20210713092440_add_permissions.rb:8:in `up'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:831:in `exec_migration'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:811:in `block in migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:471:in `with_connection'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:810:in `migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1002:in `migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1310:in `block in execute_migration_in_transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1361:in `block in ddl_transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/share/gems/gems/activesupport-6.0.4.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:212:in `transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1361:in `ddl_transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1309:in `execute_migration_in_transaction'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1281:in `block in migrate_without_lock'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1280:in `each'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1280:in `migrate_without_lock'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1229:in `block in migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1382:in `with_advisory_lock'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1229:in `migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1061:in `up'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/migration.rb:1036:in `migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <top (required)>'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/railties/databases.rake:84:in `each'
/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <top (required)>'
/usr/share/gems/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
# rm -f /usr/share/gems/gems/foreman_scc_manager-1.8.20/db/migrate/20210713092440_add_permissions.rb
# foreman-rake db:migrate
== 20220425132605 AddSccKatelloRepositoryRelation: migrating ==================
-- create_table(:scc_katello_repositories)
   -> 0.0158s
== 20220425132605 AddSccKatelloRepositoryRelation: migrated (0.0158s) =========

== 20220429100843 RemoveRootRepositoryIdFromSccRepository: migrating ==========
-- remove_foreign_key(:scc_repositories, :katello_root_repositories, {:column=>:katello_root_repository_id, :on_delete=>:nullify})
   -> 0.0023s
-- remove_column(:scc_repositories, :katello_root_repository_id, :integer, {:index=>true, :null=>true})
   -> 0.0003s
== 20220429100843 RemoveRootRepositoryIdFromSccRepository: migrated (0.0026s) =

== 20220429102717 PopulateSccKatelloRepositories: migrating ===================
== 20220429102717 PopulateSccKatelloRepositories: migrated (0.0022s) ==========

== 20220513132652 PopulateUpstreamAuthenticationToken: migrating ==============
== 20220513132652 PopulateUpstreamAuthenticationToken: migrated (0.0182s) =====
# foreman-rake db:seed
# foreman-installer --scenario katello --skip-checks-i-know-better --disable-system-checks

"Last synced" never gets updated/done with "Daily Sync interval"

We have chosen/update yesterday on Aug, 8th (8.8.2022) a "daily" sync interval with start-date 8.8.2022 at 22:22:22 - but it didn't update/sync anything yesterday evening. Why?

Currently using Katello 3.18.5 and Foreman 2.3.5 and SCC plugin Version 1.8.10-1.

Do not offer Products without Repositories for synching

Some older SCC-products do not have any repositories, after importing into Katello (e.g. SUSE Linux Enterprise Server).

These Products should not be shown on the sync-products page, because it makes no sense to import them. The page is too crowded anyway

The following command returns the scc_ids of all products without any repositories:

SccProduct.all.to_a.select{ |prod| prod.scc_repositories.empty? }.map(&:scc_id)

Sync to Proxy fails for some packages DETAIL: Failing row contains (92f54d25-6a97-46b0-8e7e-999b71a60306, SUSE-SLE-Module-Legacy-15-SP1-2020-774, null,

Hi,

I just recently upgraded to Katello 4.3 and now some packages are no longer synced to our proxies. They are failing with:

Jul 29 10:48:19 katellonew4pxy pulpcore-worker-2: DETAIL: Failing row contains (92f54d25-6a97-46b0-8e7e-999b71a60306, SUSE-SLE-Module-Legacy-15-SP1-2020-774, null, Jul 29 10:48:20 katellonew4pxy pulpcore-worker-1: pulp [66ea67d5-ea3e-456b-9fc7-59fa8adcd0a9]: pulpcore.tasking.pulpcore_worker:INFO: Task 143cf2a6-cdcb-458e-be91-dca7b4f3da2b failed (null value in column "issued_date" violates not-null constraint

I also raised this question in the foreman forum:

https://community.theforeman.org/t/content-view-not-synced-to-all-proxies/29593/6

Help is highly appreciated.

Thanks and Best Regards,
Oliver

I am unable to register SLES 12SP5 servers in foreman

Hi,

First of all, I wanted to thank you for the plugin you have developed and shared with the community. It's fantastic.

As I was saying, the plugin foreman_scc_manager (2.3.0) works perfectly, and I haven't encountered any issues in installing and configuring it in my foreman-katello installation (foreman Version 3.9.1 / Katello 4.11.0).

The problem arises when registering SLES12SP5 clients. I have followed instructions on the page https://apt.atix.de/html/sles.html, but I encounter several issues:

1.- I have added the repository https://oss.atix.de/SLES12SP5, but when trying to install the package subscription-manager, it fails due to a dependency on the package python-iniparse. This package exists in the SUSE_Package_Hub_15_SP5 repository but does not exist in the SUSE_Package_Hub_12_SP5 repository.

2.- I have installed the Python module with "pip install iniparse" and forced the installation of the subscription-manager package by skipping the dependency.

3.- I have downloaded the script katello-rhsm-consumer from my Foreman server (https://foreman.example.com/pub/katello-rhsm-consumer) and executed it. However, it fails with the following message:

Unable to find Subscription Manager module.
Error: No module named rhsm.config

subscription-manager package also installs other files like /usr/lib/rhsmd, which fails with exactly the same error:

#/usr/lib/rhsmd
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/rhsm_d.py", line 43, in excepthook_base
    sys.exit(0)
AttributeError: 'NoneType' object has no attribute 'exit'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/rhsmd", line 9, in <module>
    load_entry_point('subscription-manager==1.27.0', 'console_scripts', 'rhsmd')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/rhsm_d.py", line 62, in <module>
    from subscription_manager import logutil
  File "/usr/lib64/python2.7/site-packages/subscription_manager/logutil.py", line 19, in <module>
    import rhsm.config
**ImportError: No module named rhsm.config**

I'm not sure if I'm doing something wrong. Is it possible that the subscription-manager package for SLES12SP5 requires some additional Python modules that are not included in the package itself?

Thanks a lot.

Do not sync debuginfo and source rpms by default

SUSE does not differentiate between debuginfo, source and normal repositories in their products. So if you select a product it will make all repositories available. Furthermore in some normal repositories are also source rpms included. If you sync this by default you will need a big amount of disk space and traffic for commonly not used packages.

It would be great to not have this by default. So selecting a product should not include the debuginfo and source repositories while normal repositories are created with Ignorable Content set to Source RPM.

If you think this is a too big change in behaviour, having a setting to switch between both options would be good. I would default then to not include the unnecessary content, but could totally understand keeping the old behaviour as default.

Also to mention is if you delete the unwanted repositories it seems like there is no way to re-add them at the moment.

foreman 2.0/katello 3.16 and scc manager plugin

Getting the following error message on this install.

katello-3.15.0.1-1.el7.noarch

Oops, we're sorry but something went wrong PG::UndefinedTable: ERROR: relation "scc_accounts" does not exist LINE 1: SELECT "scc_accounts".* FROM "scc_accounts" ORDER BY "scc_a... ^ : SELECT "scc_accounts".* FROM "scc_accounts" ORDER BY "scc_accounts"."login" ASC LIMIT $1 OFFSET $2

SccManager.get_scc_data ignores global content proxy and uses non-existent setting

This plugin still uses the cdn_proxy setting:

if SETTINGS[:katello][:cdn_proxy] && SETTINGS[:katello][:cdn_proxy][:host]
proxy_config = SETTINGS[:katello][:cdn_proxy]
uri = URI('')
uri.scheme = URI.parse(proxy_config[:host]).scheme
uri.host = URI.parse(proxy_config[:host]).host
uri.port = proxy_config[:port].try(:to_s)
uri.user = proxy_config[:user]
uri.password = proxy_config[:password] if uri.user.present?
RestClient.proxy = uri.to_s
end

This setting was previously defined in the katello.yml settings file but got removed here:
theforeman/puppet-katello#315

Katello itself switched to use the globally defined content proxy here:
Katello/katello#8181

As a result, the plugin can no longer communicate with upstream targets if there is a proxy involved.

Trying to sync any repository URL returns a 404

Heya,

first of all thank you very much for this effort, i was delighted to see this level of integration between the SUSE Customer Center and Katello. Unfortunately i encountered an issue right away while getting my feet wet with this plugin:

I could add my organization credentials without issue, sync products from SCC and later enable them. (for example SUSE Linux Enterprise Server 12 SP5 x86_64). foreman_scc_manager then created the respective product and associated repositories just fine. But when i then try to sync a given repository (like 1878 SUSE Linux Enterprise Server 12 SP5 x86_64 SLES12-SP5-Pool for sle-12-x86_64 in my case) the underlying task fails:

{"pulp_tasks"=>
  [{"pulp_href"=>"/pulp/api/v3/tasks/2efada73-33c8-4c51-ba9e-6385514b2e63/",
    "pulp_created"=>"2020-08-26T15:18:04.694+00:00",
    "state"=>"failed",
    "name"=>"pulp_rpm.app.tasks.synchronizing.synchronize",
    "started_at"=>"2020-08-26T15:18:04.791+00:00",
    "finished_at"=>"2020-08-26T15:18:04.915+00:00",
    "error"=>
     {"traceback"=>
       "  File \"/usr/lib/python3.6/site-packages/rq/worker.py\", line 883, in perform_job\n" +
       "    rv = job.perform()\n" +
       "  File \"/usr/lib/python3.6/site-packages/rq/job.py\", line 645, in perform\n" +
       "    self._result = self._execute()\n" +
       "  File \"/usr/lib/python3.6/site-packages/rq/job.py\", line 651, in _execute\n" +
       "    return self.func(*self.args, **self.kwargs)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py\", line 162, in synchronize\n" +
       "    remote_url = fetch_remote_url(remote)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py\", line 130, in fetch_remote_url\n" +
       "    return fetch_mirror(remote)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py\", line 111, in fetch_mirror\n" +
       "    result = downloader.fetch()\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulpcore/download/base.py\", line 160, in fetch\n" +
       "    return done.pop().result()\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulpcore/download/base.py\", line 227, in run\n" +
       "    return await self._run(extra_data=extra_data)\n" +
       "  File \"/usr/lib/python3.6/site-packages/pulp_rpm/app/downloaders.py\", line 43, in _run\n" +
       "    response.raise_for_status()\n" +
       "  File \"/usr/lib64/python3.6/site-packages/aiohttp/client_reqrep.py\", line 946, in raise_for_status\n" +
       "    headers=self.headers)\n",
      "description"=>
       "404, message='Not Found', url=URL('https://updates.suse.com/SUSE/Products/SLE-SERVER/12-SP5/x86_64/product/?A_VERY_LONG_TOKEN')"},
    "worker"=>"/pulp/api/v3/workers/bd448edc-5907-4416-92ee-9ee507d7d809/",
    "child_tasks"=>[],
    "progress_reports"=>[],
    "created_resources"=>[],
    "reserved_resources_record"=>
     ["/pulp/api/v3/repositories/rpm/rpm/9b288ce3-0929-4c60-8479-488dbdf26856/",
      "/pulp/api/v3/remotes/rpm/rpm/82d2d5d8-07bc-4aff-bc53-1298150186fa/"]}],
 "create_version"=>true,
 "task_groups"=>[],
 "poll_attempts"=>{"total"=>1, "failed"=>1}}

And well, i receive a 404 as well when i try to visit the specific repository URL. Any hints on how to troubleshoot further?

Thanks and regards,

Mattas

Trying to sync some repositories not working

Foreman Version Katello Version foreman_scc_manager Version Platform
2.2.2 3.17.2 1.8.6 CentOS 7.9.2009

Hello,

I'm trying to sync repotories and for some I'm getting this error (but not for all):

column rpm_updatecollection.update_record_id does not exist
LINE 1: ...*) AS "__count" FROM "rpm_updatecollection" WHERE "rpm_updat...
^
HINT: Perhaps you meant to reference the column "rpm_updatecollection._update_record_id".

I have attached a file with more details.

If I'm trying to sync repos of the product Basesystem Module 15 SP2 x86_64 (id: 1946) for example it looks like this (Deleted Debug und Source Repos):
SLE-Module-Basesystem15-SP2-Pool for sle-15-x86_64 --> Success
SLE-Module-Basesystem15-SP2-Updates for sle-15-x86_64 --> Warning (Error as above)

Same goes for Server Applications Module 15 SP2 x86_64 (id: 1955) and SUSE Linux Enterprise Server 15 SP2 x86_64 (id: 1939)
Pool is working, Updates aren't working.

Am I doing something wrong here?

Best Regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.