This article was originally published on the Red Hat Customer Portal. The information may no longer be current.

In any modern development environment automation is crucial. For Red Hat flavoured OS'es, application management typically is based on RPM packages. Bringing automation into an RPM development environment sooner or later leads to Mock https://fedorahosted.org/mock/.

With Satellite-6, Mock has finally a capable life cycle management counterpart. In large projects with several teams working on interdependent components, Satellite Content Views (CVs) are powerful means to provide a solid baseline for development and change management.

In essence, Mock is creating a chroot environment for building RPM packages. Ideally, this should be independent of the architecture and release version of the build host. However, content distribution via Satellite is bound to subscriptions. To achieve releasever independence with Satellite-6, we have two options: we either broaden the content scope available to the build host or we use dedicated subscriptions for different Mock targets.

The first is possible with Satellite-6 because other than Satellite-5 it has no notion of a base channel. There is no limitation to create CVs with both RHEL-6 and RHEL-7 repos side by side. It is also possible to subscribe a host directly to Library, omitting all life cycle management via CVs.

To implement subscription based content distribution, Satellite-6 is using SSL client certs to authenticate and authorize access to the various repos. Each CV embraces one or more repos for distribution in certain life cycle environments (LCE) for a particular organization. The baseurl for these repos is encoding organization, LCE and CV in addition to releasever and architecture. The SSL client certs associated with a hosts subscription grant access only to one particular CV/LCE combination for each enabled repo.

For example, the baseurl

http://sat.example.com/pulp/repos/Default_Org/Production/RHEL_7_Baseline/content/dist/rhel/server/7/7Server/$basearch/os

requires a subscription for the RHEL 7 Baseline Content View in stage Production belonging to the Default Org. Only if the SSL client cert provides this subscription access to the repo is granted.

Configuring Mock to use Satellite-6 boils down to providing the correct SSL client certs for the required repos. As mentioned above, we can achieve this by either customizing the build host CV to contain all required repos or by giving Mock more than one subscription (taken from other template host).

The following facts need to be observed to acomplish the goal:

  • The SSL client certs and associated keys belonging to a subscription are stored in /etc/pki/entitlement/.
  • The SSL server cert is always signed with /etc/rhsm/ca/katello-server-ca.pem.
  • The yum.repo setup for a Satellite-6 host is configured in /etc/yum.repos.d/redhat.repo.

Bringing these three together makes up a proper Mock configuration.

To make the certs available to Mock, we bind mount /etc/pki/entitlement/ and /etc/rhsm/ca/ into the chroot.
The according configuration settings

config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/etc/pki/entitlement', '/etc/pki/entitlement/' ))
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/etc/rhsm/ca/', '/etc/rhsm/ca/' ))

can either be added to /etc/mock/site-defaults.cfg or to a particular chroot configuration.

If you use multiple subscriptions from template hosts you can either copy the SSL client certs to the /etc/pki/entitlement/ of the build host or you bind mount a different directory that holds a collection of all required certs.

The chroot configuration finally must include the appropriate baseurl/client cert combinations for the required repos. The easiest way to get this repo definition is by enabling it on the build- or template-host and copying the appropriate section from /etc/yum.repos.d/redhat.repo.

The resulting /etc/mock/rhel-7-x86_64.cfg should look similar to this:

config_opts['root'] = 'rhel-7-x86_64'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)
config_opts['chroot_setup_cmd'] = 'install bash bzip2 cpio diffutils gzip perl sed tar unzip which @development'
config_opts['dist'] = 'el7'
config_opts['releasever'] = '7Server'
config_opts['yum.conf'] = """
[main]
cachedir=/var/cache/yum
keepcache=1
debuglevel=1
reposdir=/dev/null
logfile=/var/log/yum.log
retries=20
obsoletes=1
gpgcheck=0
assumeyes=1
syslog_ident=mock
syslog_device=
# repos
[rhel-7-server-rpms]
name = Red Hat Enterprise Linux 7 Server (RPMs)
enabled = 1
baseurl = https://sat.example.com/pulp/repos/Default_Org/Production/RHEL_7_Baseline/content/dist/rhel/server/7/7Server/$basearch/os
ui_repoid_vars = basearch
metadata_expire = 1
sslverify = 1
sslclientkey = /etc/pki/entitlement/3132072779642053123-key.pem
sslclientcert = /etc/pki/entitlement/3132072779642053123.pem
sslcacert = /etc/rhsm/ca/katello-server-ca.pem
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

저자 소개

UI_Icon-Red_Hat-Close-A-Black-RGB

채널별 검색

automation icon

오토메이션

기술, 팀, 인프라를 위한 IT 자동화 최신 동향

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Virtualization icon

가상화

온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래