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

Update usability support for RHEL7 #75

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions config/mrepo-example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,15 @@ contrib = rsync://rsync.dist4.org/dist/$release/$arch/$repo/
extras = rsync://rsync.dist4.org/dist/$release/$arch/$repo/
merge = mrepo://$nick/contrib/
mrepo://$nick/extras/

### Example5: https with cert (RHEL7)
[dist5]
name = Distribution example $release ($arch)
release = 5
arch = x86_64
metadata = repomd repoview
os = https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os
sslkey = /usr/share/keys/key.pem
sslcert = /usr/share/keys/cert.pem
sslca = /etc/rhsm/ca/redhat-uep.pem

25 changes: 21 additions & 4 deletions mrepo
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ archs = {
'i386': ('i386', 'i486', 'i586', 'i686', 'athlon'),
'ia64': ('i386', 'i686', 'ia64'),
'ppc': ('ppc', ),
'ppc64': ('ppc', 'ppc64', 'ppc64pseries', 'ppc64iseries'),
'ppc64': ('ppc', 'ppc64', 'ppc64le', 'ppc64pseries', 'ppc64iseries'),
'x86_64': ('i386', 'i486', 'i586', 'i686', 'athlon', 'x86_64', 'amd64', 'ia32e'),
'sparc64': ('sparc', 'sparcv8', 'sparcv9', 'sparc64'),
'sparc64v': ('sparc', 'sparcv8', 'sparcv9', 'sparcv9v', 'sparc64', 'sparc64v'),
Expand Down Expand Up @@ -339,6 +339,12 @@ class Config:
dist.promoteepoch = self.cfg.get(section, option) not in disable
elif option in ('systemid',):
dist.systemid = self.cfg.get(section, option)
elif option in ('sslcert',):
dist.sslcert = self.cfg.get(section, option)
elif option in ('sslkey',):
dist.sslkey = self.cfg.get(section, option)
elif option in ('sslca',):
dist.sslca = self.cfg.get(section, option)
else:
dist.repos.append(Repo(option, self.cfg.get(section, option), dist, self))

Expand Down Expand Up @@ -385,6 +391,9 @@ class Dist:
self.discs = ()
self.isos = []
self.disabled = False
self.sslcert = None
self.sslkey = None
self.sslca = None

# def __repr__(self):
# for key, value in vars(self).iteritems():
Expand Down Expand Up @@ -721,9 +730,9 @@ class Repo:
if cf.cmd['mirrordir']:
mirrormirrordir(url, self.srcdir)
else:
mirrorlftp(url, self.srcdir)
mirrorlftp(url, self.srcdir, self.dist)
elif s in ('fish', 'http', 'https', 'sftp'):
mirrorlftp(url, self.srcdir)
mirrorlftp(url, self.srcdir, self.dist)
elif s in ('file', ''):
mirrorfile(url, self.srcdir)
elif s in ('mrepo', ):
Expand Down Expand Up @@ -1353,14 +1362,22 @@ def mirrormirrordir(url, path):
raise(mrepoMirrorException('Failed with return code: %s' % ret))


def mirrorlftp(url, path):
def mirrorlftp(url, path, dist):
"Mirror everything from a http://, ftp://, sftp://, fish:// URL"
if not cf.cmd['lftp']:
error(1, 'lftp was not found. fish, ftp, http and sftp support (using lftp) is therefore disabled.')
return
mkdir(path)

cmds = cf.lftpcommands + ';'

if dist.sslcert:
cmds = cmds + ' set ssl:cert-file ' + dist.sslcert + ';'
if dist.sslkey:
cmds = cmds + ' set ssl:key-file ' + dist.sslkey + ';'
if dist.sslca:
cmds = cmds + ' set ssl:ca-file ' + dist.sslca + ' ;'

# cmds = 'set dns:fatal-timeout 5'
if cf.lftptimeout:
cmds = cmds + ' set net:timeout %s;' % cf.lftptimeout
Expand Down