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 5 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

23 changes: 20 additions & 3 deletions mrepo
Original file line number Diff line number Diff line change
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