Skip to content

Instantly share code, notes, and snippets.

View sayan3296's full-sized avatar

Sayan Das sayan3296

  • Red Hat Inc.
  • Pune, India
  • 07:59 (UTC +05:30)
View GitHub Profile
@sayan3296
sayan3296 / gist:53244ef7084c15041d8804bdce5a6e7a
Created June 3, 2022 07:43 — forked from mccun934/gist:b25876d81d8940be1f758370b84b4e30
Sequel::Migrator::Error: More than 1 row in migrator table
# foreman-rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
TABLE dynflow_schema_info
rake aborted!
Sequel::Migrator::Error: More than 1 row in migrator table
/opt/theforeman/tfm/root/usr/share/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:590:in `schema_dataset'
/opt/theforeman/tfm/root/usr/share/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:444:in `initialize'
@sayan3296
sayan3296 / save-all-images.sh
Created September 4, 2022 10:56 — forked from lalyos/save-all-images.sh
script to save all docker image, and load them back
reload() {
source ${BASH_SOURCE[0]}
}
alias r=reload
get-image-field() {
local imageId=$1
local field=$2
: ${imageId:? reuired}
@sayan3296
sayan3296 / docker_images.sh
Created September 4, 2022 10:57 — forked from hydra1983/docker_images.sh
Save and load docker images in batch
#!/bin/bash
readonly DB_FILE="$(pwd)/images.db"
readonly IMG_DIR="$(pwd)/images"
save-images() {
echo "Create ${DB_FILE}"
echo "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s %s\n", $1, $2, $3)}'|column -t)" > "${DB_FILE}"
echo "Read ${DB_FILE}"
## Assuming that, this is a fresh satellite 6.10 with a subscription manifest imported ( having a valid RHEL sub ) and no repos are enabled at present
## Also assuming that the organization name is RedHat or else replace "--organization RedHat" with "--organization-id 1"
## Setup the repo and CV in satellite
hammer repository-set enable --name "Red Hat Satellite Tools 6.9 (for RHEL 7 Server) (RPMs)" --product "Red Hat Enterprise Linux Server" --basearch x86_64 --releasever 7Server --organization RedHat
hammer repository-set enable --name "Red Hat Ansible Engine 2.9 RPMs for Red Hat Enterprise Linux 7 Server" --product "Red Hat Ansible Engine" --basearch x86_64 --organization RedHat
#!/bin/bash
#
## Assuming that, this is a fresh satellite 6.10 or 6.11 with a subscription manifest imported ( having a valid RHEL sub ) and no repos are enabled at present
## Also assuming that the organization name is RedHat or else replace "--organization RedHat" with "--organization-id 1"
## Refresh manifest once
hammer subscription refresh-manifest --organization RedHat
## Setup the repo and CV in satellite
@sayan3296
sayan3296 / breakfix_content_migration.sh
Last active January 17, 2023 11:32
To create problems during pulp2 to pulp3 migration
#!/bin/bash
#
## Assuming satellite 6.9 is installed with organization name RedHat and a manifest with valid rhel sub has been imported.
## No repositories are enabled at this stage.
## Setup the basic environment
hammer subscription refresh-manifest --organization RedHat
hammer repository-set disable --name "Red Hat Enterprise Linux 7 Server (RPMs)" --product "Red Hat Enterprise Linux Server" --basearch x86_64 --releasever 7Server --organization RedHat
@sayan3296
sayan3296 / breakfix_installer_bad_rpm.sh
Last active January 18, 2023 10:27
Reproduce the same issue as case 03291784
#!/bin/bash
#
## Assuming satellite 6.10 is installed with organization name RedHat and a manifest with valid rhel sub has been imported.
## No repositories are enabled at this stage.
find /root/ssl-build -name "*.rpm" | egrep -v "katello-" > /tmp/rpms_to_corrupt
for i in `cat /tmp/rpms_to_corrupt`; do if [ -f $i ]; then sed -i '1d' $i; else echo "$i does not exists"; fi; done
rm -f /tmp/rpms_to_corrupt
@sayan3296
sayan3296 / Ldap Auth debug
Last active October 27, 2022 15:21
Enable debug logging for ldap authentication stuff
- Enable debug.
1. Take a backup
# cp -pvar /etc/foreman/settings.yaml /etc/foreman/settings.yaml_orig
2. Look for this section on satellite,
~~
# grep ^:logging /etc/foreman/settings.yaml -A10
:logging:
:level: info
@sayan3296
sayan3296 / breakfix_qpidd_not_starting.sh
Last active October 29, 2022 14:06
Qpidd service not starting due to sudo errors ( case 03347873 )
#!/bin/bash
#
## Assuming satellite 6.10 or 6.11 is installed with organization name RedHat.
## Also the "strace" package should be installed on the satellite server OS
for i in KATELLO_AGENT_STAT QPID_STAT; do unset $i; done
KATELLO_AGENT_STAT=$(awk '/enable_katello_agent:/{print $NF}' /etc/foreman-installer/scenarios.d/satellite-answers.yaml)
if [[ $KATELLO_AGENT_STAT = "false" ]]
@sayan3296
sayan3296 / rhel_6_els_cert_deploy.sh
Created November 2, 2022 21:39
To deploy ELS product certs on RHEL 6 systems
#!/bin/bash
# Create directory /etc/pki/product/.
mkdir -p /etc/pki/product/
# Remove existing 69.pem files
[ -f /etc/pki/product-default/69.pem ] && rm -f /etc/pki/product-default/69.pem
[ -f /etc/pki/product/69.pem ] && rm -f /etc/pki/product-default/69.pem
sleep 3