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

add debian support #184

Merged
merged 2 commits into from
Jan 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions templates/rhsm-katello-reconfigure.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PREFIX=<%= scope['certs::katello::deployment_url'] %>
CFG=/etc/rhsm/rhsm.conf
CFG_BACKUP=$CFG.kat-backup
CA_TRUST_ANCHORS=/etc/pki/ca-trust/source/anchors
OSFAMILY=$(sed -n -e "s/ID\s*=\s*\(.*\)/\1/p" /etc/os-release)

# exit on non-RHEL systems or when rhsm.conf is not found
test -f $CFG || exit
Expand All @@ -23,14 +24,25 @@ chmod 644 $KATELLO_CERT_DIR/$KATELLO_SERVER_CA_CERT
echo "$KATELLO_DEFAULT_CA_DATA" > $KATELLO_CERT_DIR/$KATELLO_DEFAULT_CA_CERT
chmod 644 $KATELLO_CERT_DIR/$KATELLO_DEFAULT_CA_CERT

# if atomic machine handle it the atomic way, else handle the regular rhel way
# if atomic or debian machine handle it the special way, else handle the regular rhel way
if [ -n "${IS_ATOMIC+1}" ] || [ -e "/run/ostree-booted" ]
then
#atomic setup
# atomic setup
BASEURL=https://$KATELLO_SERVER/pulp/ostree/web/

# configure rhsm
# the config command was introduced in rhsm 0.96.6
subscription-manager config \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we DRY this? Maybe wrap just BASEURL= foo around an if else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

--server.hostname="$KATELLO_SERVER" \
--server.prefix="$PREFIX" \
--server.port="$PORT" \
--rhsm.repo_ca_cert="%(ca_cert_dir)s$KATELLO_SERVER_CA_CERT" \
--rhsm.baseurl="$BASEURL"
elif [ "${OSFAMILY}" = "debian" ]
then
# Debian setup
BASEURL=https://$KATELLO_SERVER/pulp/deb

subscription-manager config \
--server.hostname="$KATELLO_SERVER" \
--server.prefix="$PREFIX" \
Expand Down Expand Up @@ -70,7 +82,7 @@ else
sed -i "s/full_refresh_on_yum\s*=.*$/full_refresh_on_yum = 1/g" $CFG
else
full_refresh_config="#config for on-premise management\nfull_refresh_on_yum = 1"
sed -i "s/baseurl.*/&\n\n$full_refresh_config/g" $CFG
sed -i "/baseurl/a\n$full_refresh_config" $CFG
fi
fi

Expand Down