Remove rhsm and satellite logic

Change-Id: I81bc2cf3972019cbf8ab8a3cf16fd550ba563adb
Partial-Bug: #1431389
This commit is contained in:
Matthew Mosesohn 2015-04-17 14:32:58 +03:00 committed by Sergii Golovatiuk
parent 9b26cb98e7
commit 5f2d1646b1
13 changed files with 1 additions and 948 deletions

View File

@ -47,8 +47,6 @@ class cobbler::snippets {
cobbler_snippet {"puppet_install_if_enabled":}
cobbler_snippet {"puppet_conf":}
cobbler_snippet {"puppet_register_if_enabled":}
cobbler_snippet {"red_hat_register_rhsm":}
cobbler_snippet {"red_hat_register_satellite":}
cobbler_snippet {'ntp_register_if_enabled':}
cobbler_snippet {"mcollective_install_if_enabled":}
cobbler_snippet {"mcollective_conf":}

View File

@ -254,12 +254,6 @@ $SNIPPET('centos_post_kernel_lt_if_enabled')
# FROM /etc/ssh/sshd_config
$SNIPPET('ssh_disable_gssapi')
# COBBLER EMBEDDED SNIPPET: 'redhat_register'
# REGISTER AT REDHAT WITH ACTIVATION KEY
$SNIPPET('red_hat_register_satellite')
# REGISTER TO RED HAT SUBSCRIPTION MANAGER WITH LOGIN/PASSWORD
$SNIPPET('red_hat_register_rhsm')
# Let's not wait forewer when ssh'ing:
sed -i --follow-symlinks -e '/UseDNS/d' /etc/ssh/sshd_config
echo 'UseDNS no' >> /etc/ssh/sshd_config

View File

@ -1,32 +0,0 @@
# begin Red Hat Network certificate-based server registration
#if $redhat_management_type == "cert" and $redhat_register_user != "" and $redhat_register_password != ""
# Necessary packages
if ! rpm -q subscription-manager &>/dev/null; then
yum -y install subscription-manager
fi
if ! rpm -q virt-what &>/dev/null; then
yum -y install virt-what
fi
# Subscribe (register) the system, but don't attach
subscription-manager register --username=$redhat_register_user --password=$redhat_register_password
# Get Red Hat OpenStack profile
if [ \$(virt-what | wc -c) -gt 2 ]; then
system_type="Virtual"
else
system_type="Physical"
fi
# Capture Pool ID and register
poolid=\$(subscription-manager list --available | awk "BEGIN {RS=\"\\n\\n\";} /$system_type/ && /OpenStack/ { print; exit; }" | grep "Pool Id:" | awk '{ print $3;}')
subscription-manager attach --pool="$poolid"
# Add what used to be called channels
yum -y install yum-utils
yum-config-manager --enable rhel-6-server-optional-rpms &> /dev/null
yum-config-manager --enable rhel-6-server-supplementary &> /dev/null
#else
# not configured to use Certificate-based RHN (ok)
#end if
# end Red Hat Network certificate-based server registration

View File

@ -1,20 +0,0 @@
# begin Red Hat management server registration
#if $redhat_management_type != "off" and $redhat_management_key != ""
mkdir -p /usr/share/rhn/
#if $redhat_management_type == "site"
#set $mycert_file = "RHN-ORG-TRUSTED-SSL-CERT"
#set $mycert = "/usr/share/rhn/" + $mycert_file
wget --tries=3 -T 5 http://$redhat_management_server/pub/RHN-ORG-TRUSTED-SSL-CERT -O $mycert
perl -npe 's/RHNS-CA-CERT/$mycert_file/g' -i /etc/sysconfig/rhn/*
#end if
#if $redhat_management_type == "hosted"
#set $mycert = "/usr/share/rhn/RHNS-CA-CERT"
#end if
#set $endpoint = "https://%s/XMLRPC" % $redhat_management_server
rhnreg_ks --serverUrl=$endpoint --sslCACert=$mycert --activationkey=$redhat_management_key
#else
# not configured to register to any Red Hat management server (ok)
#end if
# end Red Hat management server registration

View File

@ -13,7 +13,7 @@ $dependent_dirs = ["/var/log/docker-logs", "/var/log/docker-logs/remote",
"/var/log/docker-logs/nailgun", "/var/log/docker-logs/naily",
"/var/log/docker-logs/nginx", "/var/log/docker-logs/ntpstats",
"/var/log/docker-logs/puppet", "/var/log/docker-logs/rabbitmq",
"/var/log/docker-logs/rhsm", "/var/log/docker-logs/supervisor",
"/var/log/docker-logs/supervisor",
"/var/lib/fuel", "/var/lib/fuel/keys",
"/var/lib/fuel/container_data",
"/var/lib/fuel/container_data/${release}",

View File

@ -1,24 +0,0 @@
class osnailyfacter::rpmcache {
$rh_base_channels = "rhel-6-server-rpms rhel-6-server-optional-rpms rhel-lb-for-rhel-6-server-rpms rhel-rs-for-rhel-6-server-rpms rhel-ha-for-rhel-6-server-rpms rhel-server-ost-6-folsom-rpms"
$rh_openstack_channel = "rhel-server-ost-6-3-rpms"
$sat_base_channels = "rhel-x86_64-server-6 rhel-x86_64-server-optional-6 rhel-x86_64-server-lb-6 rhel-x86_64-server-rs-6 rhel-x86_64-server-ha-6"
$sat_openstack_channel = "rhel-x86_64-server-6-ost-3"
class { 'rpmcache::rpmcache':
releasever => "6Server",
pkgdir => "/var/www/nailgun/rhel/6.4/nailgun/x86_64",
rh_username => $::fuel_settings['rh_username'],
rh_password => $::fuel_settings['rh_password'],
rh_base_channels => $rh_base_channels,
rh_openstack_channel => $rh_openstack_channel,
use_satellite => $::fuel_settings['use_satellite'],
sat_hostname => $::fuel_settings['sat_hostname'],
activation_key => $::fuel_settings['activation_key'],
sat_base_channels => $sat_base_channels,
sat_openstack_channel => $sat_openstack_channel
}
}

View File

@ -1,22 +0,0 @@
node default {
$rh_base_channels = "rhel-6-server-rpms rhel-6-server-optional-rpms rhel-lb-for-rhel-6-server-rpms rhel-rs-for-rhel-6-server-rpms rhel-ha-for-rhel-6-server-rpms"
$rh_openstack_channel = "rhel-server-ost-6-3-rpms"
$numtries = "3"
$sat_base_channels = "rhel-x86_64-server-6 rhel-x86_64-server-optional-6 rhel-x86_64-server-lb-6 rhel-x86_64-server-rs-6 rhel-x86_64-server-ha-6"
$sat_openstack_channel = "rhel-x86_64-server-6-ost-3"
class { "rpmcache":
releasever => "6Server",
pkgdir => "/var/www/nailgun/rhel/6.4/nailgun/x86_64",
rh_username => "your_rh_username",
rh_password => "your_rh_password",
rh_base_channels => $rh_base_channels,
rh_openstack_channel => $rh_openstack_channel,
use_satellite => false,
sat_hostname => undef,
activation_key => undef,
sat_base_channels => $sat_base_channels,
sat_openstack_channel => $sat_openstack_channel
}
}

View File

@ -1,33 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.13 (GNU/Linux)
mQINBErgSTsBEACh2A4b0O9t+vzC9VrVtL1AKvUWi9OPCjkvR7Xd8DtJxeeMZ5eF
0HtzIG58qDRybwUe89FZprB1ffuUKzdE+HcL3FbNWSSOXVjZIersdXyH3NvnLLLF
0DNRB2ix3bXG9Rh/RXpFsNxDp2CEMdUvbYCzE79K1EnUTVh1L0Of023FtPSZXX0c
u7Pb5DI5lX5YeoXO6RoodrIGYJsVBQWnrWw4xNTconUfNPk0EGZtEnzvH2zyPoJh
XGF+Ncu9XwbalnYde10OCvSWAZ5zTCpoLMTvQjWpbCdWXJzCm6G+/hx9upke546H
5IjtYm4dTIVTnc3wvDiODgBKRzOl9rEOCIgOuGtDxRxcQkjrC+xvg5Vkqn7vBUyW
9pHedOU+PoF3DGOM+dqv+eNKBvh9YF9ugFAQBkcG7viZgvGEMGGUpzNgN7XnS1gj
/DPo9mZESOYnKceve2tIC87p2hqjrxOHuI7fkZYeNIcAoa83rBltFXaBDYhWAKS1
PcXS1/7JzP0ky7d0L6Xbu/If5kqWQpKwUInXtySRkuraVfuK3Bpa+X1XecWi24JY
HVtlNX025xx1ewVzGNCTlWn1skQN2OOoQTV4C8/qFpTW6DTWYurd4+fE0OJFJZQF
buhfXYwmRlVOgN5i77NTIJZJQfYFj38c/Iv5vZBPokO6mffrOTv3MHWVgQARAQAB
tDNSZWQgSGF0LCBJbmMuIChyZWxlYXNlIGtleSAyKSA8c2VjdXJpdHlAcmVkaGF0
LmNvbT6InAQQAQIABgUCTGEUZQAKCRDurUz9SaVj2aMPA/0fQlMqU+m+wSTUMs5P
ocFo2/KF1U5D3rySCkWJQJB4HeNsYuyJVz6VVH7fEITqulNJJE4WS029BsxjrZlF
KAGAdI0/Xu59oX9jmb7UkR9lzJF3EFF+NlsLMI9FVZJHgMA3l4kWr7udjdxGze9U
jTt2emJvEexByfzxMvNcLEsLTIkCNgQTAQIAIAUCSuBJOwIbAwYLCQgHAwIEFQII
AwQWAgMBAh4BAheAAAoJEBmeL5H9Qx1RbOkP/2zlIVH9kXfKNjlUtQUsxcgpTO00
3ehzjl/It1Mjf5QKUoLa0Su7NiOo0eGoARdraw3V8yuy4p5zrUuXY1+8mOQsoO+B
UiHuQztqyU1hU4/oFN8L8knv+5/PdRmbJWIf9YOX4Bh2CTcmoIg7nDmvKsL0jIHN
i/abQephtZ+mFje4fDm6fed0sly7z4EY/kX441AQaX4NEfnwiX0mncfBtFrt2+Q+
ASF8VH7WEj4G21rYLsTT/Y0rMLFnDsvHc8FFxT3ZgrJoSKF/L9pApkIC7J8qIy+y
bOz7imghfsj01AImnIQgZ8g2hntXGofBGf93mbDYxlMmNvNJ/5Sb1gnIDSIQTIPq
qOuJZBFu7GlBeaUAluHyiRniBtUW/UXwzMr7hHxW9YnRfGC2KRKjvZ8ePCFrswCO
oWc6rp6jp8QL/vmDc0saG3lV2ka4eTS9t0Q0cwLzBL317mpcY0O553eGVNq8MyUQ
AeXfirYf2dqRMZEXkqIlR82HcNVEaGDxwwi2LbWeOJGHuDIUjY5xwBNjtsFKvv0m
G43B6Ue7EusIWljtXbk4WS2XXmNklozG5AGph0GBJrLYbRToPX7tWxa5+nN38BvH
X9zeiL1lom9bbaQCCCp3N0DbtRRiNa/HjbD2Z6cnCH/SN5BxN5whR3R3SsVzD9zW
m+AwyX9DvfLMqApj
=SsXO
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -1,258 +0,0 @@
#!/usr/bin/python -tt
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# (c) 2005 seth vidal skvidal at phy.duke.edu
# helps partially track a repo. Let's you download a package + all of its
# deps from any set of repos.
# use: so you can keep current on any given pkg + its deps from another
# repo w/o enabling that repo in your yum configuration by default
# also for making partial mirrors that traverse dependencies.
import os
import sys
import shutil
from optparse import OptionParser
from urlparse import urljoin
import logging
import yum
import yum.Errors
import rpmUtils
from yum.misc import getCacheDir
from yum.constants import *
from yum.packages import parsePackages
from yum.packageSack import ListPackageSack
# for yum 2.4.X compat
def sortPkgObj(pkg1 ,pkg2):
"""sorts a list of yum package objects by name"""
if pkg1.name > pkg2.name:
return 1
elif pkg1.name == pkg2.name:
return 0
else:
return -1
class RepoTrack(yum.YumBase):
def __init__(self, opts):
yum.YumBase.__init__(self)
self.logger = logging.getLogger("yum.verbose.repotrack")
self.opts = opts
def findDeps(self, po):
"""Return the dependencies for a given package, as well
possible solutions for those dependencies.
Returns the deps as a dict of:
dict[reqs] = [list of satisfying pkgs]"""
reqs = po.returnPrco('requires')
reqs.sort()
pkgresults = {}
for req in reqs:
(r,f,v) = req
if r.startswith('rpmlib('):
continue
pkgresults[req] = list(self.whatProvides(r, f, v))
return pkgresults
def more_to_check(unprocessed_pkgs):
for pkg in unprocessed_pkgs.keys():
if unprocessed_pkgs[pkg] is not None:
return True
return False
def parseArgs():
usage = """
Repotrack: keep current on any given pkg and its deps. It will download the package(s) you
want to track and all of their dependencies
%s [options] package1 [package2] [package..] """ % sys.argv[0]
parser = OptionParser(usage=usage)
parser.add_option("-c", "--config", default='/etc/yum.conf',
help='config file to use (defaults to /etc/yum.conf)')
parser.add_option("-a", "--arch", default=None,
help='check as if running the specified arch (default: current arch)')
parser.add_option("-r", "--repoid", default=[], action='append',
help="specify repo ids to query, can be specified multiple times (default is all enabled)")
parser.add_option("-t", "--tempcache", default=False, action="store_true",
help="Use a temp dir for storing/accessing yum-cache")
parser.add_option("-p", "--download_path", dest='destdir',
default=os.getcwd(), help="Path to download packages to")
parser.add_option("-u", "--urls", default=False, action="store_true",
help="Just list urls of what would be downloaded, don't download")
parser.add_option("-n", "--newest", default=True, action="store_false",
help="Toggle downloading only the newest packages(defaults to newest-only)")
parser.add_option("-q", "--quiet", default=False, action="store_true",
help="Output as little as possible")
(opts, args) = parser.parse_args()
return (opts, args)
def main():
# TODO/FIXME
# gpg/sha checksum them
(opts, user_pkg_list) = parseArgs()
if len(user_pkg_list) == 0:
print >> sys.stderr, "Error: no packages specified to parse"
sys.exit(1)
if not os.path.exists(opts.destdir) and not opts.urls:
try:
os.makedirs(opts.destdir)
except OSError, e:
print >> sys.stderr, "Error: Cannot create destination dir %s" % opts.destdir
sys.exit(1)
if not os.access(opts.destdir, os.W_OK) and not opts.urls:
print >> sys.stderr, "Error: Cannot write to destination dir %s" % opts.destdir
sys.exit(1)
my = RepoTrack(opts=opts)
my.doConfigSetup(fn=opts.config,init_plugins=True) # init yum, WITH plugins
if opts.arch:
#archlist = []
#archlist.extend(rpmUtils.arch.getArchList(opts.arch))
archlist = opts.arch.split(',') # Change to this
else:
archlist = rpmUtils.arch.getArchList()
# do the happy tmpdir thing if we're not root
if os.geteuid() != 0 or opts.tempcache:
cachedir = getCacheDir()
if cachedir is None:
print >> sys.stderr, "Error: Could not make cachedir, exiting"
sys.exit(50)
my.repos.setCacheDir(cachedir)
if len(opts.repoid) > 0:
myrepos = []
# find the ones we want
for glob in opts.repoid:
myrepos.extend(my.repos.findRepos(glob))
# disable them all
for repo in my.repos.repos.values():
repo.disable()
# enable the ones we like
for repo in myrepos:
repo.enable()
my._getSacks(archlist=archlist, thisrepo=repo.id)
my.doRepoSetup()
my._getSacks(archlist=archlist)
unprocessed_pkgs = {}
final_pkgs = {}
pkg_list = []
avail = my.pkgSack.returnPackages()
for item in user_pkg_list:
exactmatch, matched, unmatched = parsePackages(avail, [item])
pkg_list.extend(exactmatch)
pkg_list.extend(matched)
if opts.newest:
this_sack = ListPackageSack()
this_sack.addList(pkg_list)
pkg_list = this_sack.returnNewestByNameArch()
del this_sack
if len(pkg_list) == 0:
print >> sys.stderr, "Nothing found to download matching packages specified"
sys.exit(1)
for po in pkg_list:
unprocessed_pkgs[po.pkgtup] = po
while more_to_check(unprocessed_pkgs):
for pkgtup in unprocessed_pkgs.keys():
if unprocessed_pkgs[pkgtup] is None:
continue
po = unprocessed_pkgs[pkgtup]
final_pkgs[po.pkgtup] = po
deps_dict = my.findDeps(po)
unprocessed_pkgs[po.pkgtup] = None
for req in deps_dict.keys():
pkg_list = deps_dict[req]
if opts.newest:
this_sack = ListPackageSack()
this_sack.addList(pkg_list)
pkg_list = this_sack.returnNewestByNameArch()
del this_sack
for res in pkg_list:
if res is not None and res.pkgtup not in unprocessed_pkgs:
unprocessed_pkgs[res.pkgtup] = res
download_list = final_pkgs.values()
if opts.newest:
this_sack = ListPackageSack()
this_sack.addList(download_list)
download_list = this_sack.returnNewestByNameArch()
download_list.sort(sortPkgObj)
for pkg in download_list:
repo = my.repos.getRepo(pkg.repoid)
remote = pkg.returnSimple('relativepath')
local = os.path.basename(remote)
local = os.path.join(opts.destdir, local)
if (os.path.exists(local) and
os.path.getsize(local) == int(pkg.returnSimple('packagesize'))):
if not opts.quiet:
my.logger.info("%s already exists and appears to be complete" % local)
continue
if opts.urls:
url = urljoin(repo.urls[0],remote)
print '%s' % url
continue
# Disable cache otherwise things won't download
repo.cache = 0
if not opts.quiet:
my.logger.info('Downloading %s' % os.path.basename(remote))
pkg.localpath = local # Hack: to set the localpath to what we want.
path = repo.getPackage(pkg)
if not os.path.exists(local) or not os.path.samefile(path, local):
shutil.copy2(path, local)
if __name__ == "__main__":
main()

View File

@ -1,67 +0,0 @@
# This file is used by rsync
# Format + pkgname
# Comments are ignored by rsync
# Exclude is "- pattern"
+ GeoIP*
+ MySQL*wsrep*
+ MySQL-python*
+ augeas*
+ cirros-testvm*
+ crmsh*
+ c-ares19*
+ daemonize*
+ erlang*
+ euca2ools*
+ facter*
+ galera*
+ gdisk*
+ hiera*
+ http-parser*
+ libicu*
+ libuv*
+ mcollective*
+ *murano*
+ nailgun*
+ nginx*
+ nodejs*
+ pssh*
+ puppet-*
+ pushy-*
+ python-amqp*
+ python-amqplib*
+ python-anyjson*
+ python-importlib*
+ python-kombu*
+ python-lesscpy*
+ python-meld3*
+ python-ordereddict*
+ python-routes*
+ python-pip*
+ python-ply*
+ python-virtualenv*
+ rabbitmq-server*
+ ruby-ri*
+ ruby-augeas*
+ ruby-shadow*
+ rubygem-daemons*
+ rubygem-fastthread
+ rubygem-gem_plugin
+ rubygem-mongrel*
+ rubygem-netaddr*
+ rubygem-openstack*
+ rubygem-json*
+ rubygem-rake*
+ rubygem-stomp*
+ rubygems-*
+ *sahara*
+ scapy*
+ socat*
+ supervisor*
+ tinyproxy*
+ v8*
+ wxBase*
+ wxGTK*
+ xfsprogs*
+ xinetd*
# Do not remove this line
- *.rpm

View File

@ -1,163 +0,0 @@
Django14
MySQL-python
SDL
atk
authconfig
avahi
bind-utils
bridge-utils
btrfs-progs
cairo
cifs-utils
cluster-glue-libs
clusterlib
cman
cobbler
cobbler-web
corosync
cpp
crmsh
cronie
cronie-noanacron
crontabs
cups-libs
curl
device-mapper
device-mapper-libs
dhclient
dmidecode
dnsmasq-utils
e2fsprogs
euca2ools
daemonize
fence-agents
fontconfig
freetype
gcc
gcc-c++
gtk2
haproxy
hicolor-icon-theme
httpd
iproute
iproute-doc
jasper-libs
keepalived
kernel-devel
kernel-headers
libXcomposite
libXcursor
libXdamage
libXfixes
libXft
libXinerama
libXrandr
libXrender
libXxf86vm
libguestfs-tools-c
libselinux-ruby
libpng
librelp
libqb
libthai
libtiff
lokkit
make
man
memcached
mesa-libGL
mesa-libGLU
mlocate
mod_fastcgi
mpfr
mysql
mysql-libs
mysql-server
novnc
ntp
numpy
openais
openaislib
openssh-clients
openssh-server
openssl-devel
openssl098e
openstack-cinder
openstack-dashboard
openstack-heat
openstack-heat-common
openstack-heat-engine
openstack-heat-api
openstack-heat-api-cfn
openstack-heat-api-cloudwatch
openstack-glance
openstack-keystone
openstack-nova
openstack-nova-novncproxy
openstack-neutron
openstack-neutron-openvswitch
openstack-selinux
openstack-swift
openstack-swift-account
openstack-swift-container
openstack-swift-object
openstack-swift-proxy
openstack-utils
openvswitch
openvswitch-controller
pacemaker
pango
patch
pciutils
policycoreutils
postgresql
postgresql-devel
postgresql-libs
postgresql-server
python-amqp
python-anyjson
python-argparse
python-cinder
python-devel
python-heatclient
python-keystone
python-novaclient
python-oslo-config
python-neutronclient
python-rhsm
python-setuptools
python-six
python-stevedore
python-webob
python-webob1.0
python-webob1.2
qpid-cpp-client
qpid-cpp-server
qpid-cpp-server-ssl
qpid-cpp-server-store
qpid-tests
qpid-tools
redhat-release-server
redhat-rpm-config
resource-agents
rhel-boot-image
rhn-setup
rsyslog-relp
ruby
ruby-devel
ruby-irb
ruby-rdoc
rubygems
screen
subscription-manager
system-config-firewall-base
tk
tmux
unixODBC
unzip
usermode
wget
wxBase
wxGTK
wxGTK-gl
yum-utils

View File

@ -1,121 +0,0 @@
class rpmcache::rpmcache ( $releasever, $pkgdir, $numtries,
$rh_username, $rh_password, $rh_base_channels, $rh_openstack_channel,
$use_satellite = false, $sat_hostname = "", $activation_key = "",
$sat_base_channels, $sat_openstack_channel, $numtries = 10) {
Exec {path => '/usr/bin:/bin:/usr/sbin:/sbin'}
$redhat_management_type = $use_satellite ? {
"true" => "site",
"false" => "cert",
default => "cert",
}
$redhat_management_key = $activation_key ? {
/[[:alnum:]]/ => "redhat_management_key=$activation_key",
default => undef,
}
$redhat_management_server = $sat_hostname ? {
/[[:alnum:]]/ => "redhat_management_server=$sat_hostname",
default => undef,
}
package { "yum-utils":
ensure => "installed"
} ->
package { "subscription-manager":
ensure => "installed"
} ->
file { '/etc/pki/product':
ensure => directory,
} ->
file { '/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release':
ensure => present,
source => 'puppet:///modules/rpmcache/RPM-GPG-KEY-redhat-release',
owner => 'root',
group => 'root',
mode => 0644,
} ->
exec { 'rpm-import-rh-gpg-key':
command => 'rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release',
require => File['/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release'],
logoutput => true
} ->
file { '/etc/nailgun/':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755'
} ->
file { '/etc/nailgun/required-rpms.txt':
ensure => present,
source => 'puppet:///modules/rpmcache/required-rpms.txt',
owner => 'root',
group => 'root',
mode => 0644,
require => File['/etc/nailgun/']
} ->
file { '/usr/local/bin':
ensure => directory,
} ->
file { '/usr/local/bin/repotrack':
ensure => present,
source => 'puppet:///modules/rpmcache/repotrack',
owner => 'root',
group => 'root',
mode => 0755,
} ->
file { '/usr/sbin/build_rpm_cache':
content => template('rpmcache/build_rpm_cache.erb'),
owner => 'root',
group => 'root',
mode => 0755,
} ->
exec { 'build_rpm_cache':
command => '/usr/sbin/build_rpm_cache',
require => File['/usr/sbin/build_rpm_cache'],
logoutput => true,
timeout => 0
} ->
cobbler_distro { "rhel-x86_64":
kernel => "${pkgdir}/isolinux/vmlinuz",
initrd => "${pkgdir}/isolinux/initrd.img",
arch => "x86_64",
breed => "redhat",
osversion => "rhel6",
ksmeta => "tree=http://@@server@@:8080/rhel/6.4/nailgun/x86_64/",
} ->
cobbler_profile { "rhel-x86_64":
kickstart => "/var/lib/cobbler/kickstarts/centos-x86_64.ks",
kopts => "biosdevname=0",
distro => "rhel-x86_64",
ksmeta => "redhat_register_user=${rh_username} redhat_register_password=${rh_password} redhat_management_type=$redhat_management_type $redhat_management_server $redhat_management_key",
menu => true,
require => Cobbler_distro["rhel-x86_64"],
} ->
exec {'rebuild-fuel-repo':
command => "/bin/cp -f /var/www/nailgun/centos/x86_64/repodata/comps.xml ${pkgdir}/repodata/comps.xml; /usr/bin/createrepo --simple-md-filenames -g ${pkgdir}/repodata/comps.xml ${pkgdir}",
}
file { '/etc/nailgun/req-fuel-rhel.txt':
ensure => present,
source => 'puppet:///modules/rpmcache/req-fuel-rhel.txt',
owner => 'root',
group => 'root',
mode => 0644,
require => File['/etc/nailgun/']
} ->
exec {'fuel-rpms':
command => "/bin/mkdir -p ${pkgdir}/fuel/Packages; rsync -ra --include-from=/etc/nailgun/req-fuel-rhel.txt /var/www/nailgun/centos/x86_64/Packages/. ${pkgdir}/fuel/Packages/.",
logoutput => true,
before => Exec['rebuild-fuel-repo'],
}
}

View File

@ -1,199 +0,0 @@
#!/bin/bash -xe
function revert_back_to_centos() {
# Removes redhat-release-server rpm and replaces it with centos-release
echo "Removing Red Hat temporary configuration."
if rpm -q redhat-release-server &>/dev/null; then
rpm -Uvh --force /root/centos-release/centos-release*.rpm
rm -f /etc/yum.repos.d/CentOS*
rpm -e --nodeps --noscripts redhat-release-server
fi
#Disable subscription-manager and rhn plugins
for plugin in $rhsm_plugins $rhn_plugins; do
sed -i 's/^enabled.*/enabled=0/' "/etc/yum/pluginconf.d/${plugin}.conf" 2>/dev/null || :
done
rm -f /etc/yum/vars/releasever
#Remove libqb hack
sed -i '/^exclude=libqb-0.16/d' /etc/yum.conf
yum-config-manager --enable 'nailgun' &> /dev/null
echo "Unsubscribing from RHSM..."
subscription-manager unregister || :
}
rhsm_plugins="product-id subscription-manager"
rhn_plugins="rhnplugin"
#Enable subscription-manager plugins
for plugin in $rhsm_plugins; do
sed -i 's/^enabled.*/enabled=1/' "/etc/yum/pluginconf.d/${plugin}.conf" 2>/dev/null || :
done
#Register
exitcode=0
rhsmoutput=$(subscription-manager register "--username=<%= rh_username %>" "--password=<%= rh_password %>" --autosubscribe --force 2>&1) || exitcode=$?
exitcode=$?
case $exitcode in
0) echo "Register succeeded"
;;
1) echo "Register succeeded"
;;
*) echo -e "Register failed: $rhmsoutput"
exit $exitcode
;;
esac
#Attach to RHOS product
poolid="$(subscription-manager list --available | grep -A2 "OpenStack" | tail -1 | cut -c15- | tr -d ' \t')"
subscription-manager attach "--pool=$poolid"
trap revert_back_to_centos EXIT
#Set releasever and refresh repos
echo 6Server > /etc/yum/vars/releasever
yum clean expire-cache
#Enable channels
for channel in <%= rh_base_channels %> <%= rh_openstack_channel %>; do
yum-config-manager --enable "$channel" &> /dev/null
done
#Tell RHSM to let CentOS accept packages from Red Hat
#Generate /etc/yum.repos.d/redhat.repo
yum --releasever=<%= releasever %> repolist || :
<% if use_satellite %>
#Save centos-release RPM so it can be reinstalled later
mkdir -p /root/centos-release
yumdownloader --destdir /root/centos-release --disablerepo='*rhel*' centos-release
if ! [ -f /root/centos-release/centos-release*.rpm ]; then
echo "Unable to download centos-release RPM. Aborting." 1>&2
exit 1
fi
#Download RHN packages needed for RHN Satellite registration
rhnpackages="m2crypto rhn-check rhn-client-tools rhnlib rhnsd rhn-setup yum-rhn-plugin redhat-release-server"
rm -rf /root/rhnpackages
mkdir -p /root/rhnpackages
yum-config-manager --enable rhel-6-server-rpms &> /dev/null
success="false"
for tries in 1 2 3; do
yumdownloader --releasever=<%= releasever %> --disablerepo='nailgun*' --disablerepo='fuel*' --setopt='*.skip_if_unavailable=1' --resolve --destdir /root/rhnpackages $rhnpackages
#Verify we have packages downloaded
if [[ "$(find /root/rhnpackages | wc -l)" > 2 ]]; then
success="true"
break
fi
yum clean expire-cache
done
if [[ "$success" == "false" ]];then
echo "Unable to download rhn-setup and redhat-release-server from RHSM." 1>&2
echo "This may be due to a network error or yum configuration." 1>&2
fi
#Delete in case yumdownloader gets extra packages
repomanage -o /root/rhnpackages | xargs rm -f
rpm -ivh --force /root/rhnpackages/*.rpm
#Download RHN Satellite GPG key
mkdir -p /etc/sysconfig/rhn
wget "<%= sat_hostname %>/pub/RHN-ORG-TRUSTED-SSL-CERT" -O /etc/sysconfig/rhn/RHNS-CA-CERT
if [ "$(file -b /etc/sysconfig/rhn/RHNS-CA-CERT)" != "ASCII text" ]; then
echo "GPG Key download failed. Looking for URL <%= sat_hostname %>/pub/RHN-ORG-TRUSTED-SSL-CERT. Cannot proceed"
exit 1
fi
#Disable subscription-manager
subscription-manager unregister
rm -rf /etc/yum.repos.d/redhat.repo
#Disable subscription-manager plugins
for plugin in $rhsm_plugins; do
sed -i 's/^enabled.*/enabled=0/' "/etc/yum/pluginconf.d/${plugin}.conf" 2>/dev/null || :
done
#Run registration
rhnreg_ks "--serverUrl=http://<%= sat_hostname %>/XMLRPC" --profilename=fuelweb "--activationkey=<%= activation_key %>" --sslCACert=/etc/sysconfig/rhn/RHNS-CA-CERT --nopackages --nohardware --novirtinfo --norhnsd --force
if [ $? -ne 0 ]; then
echo "Registration failed. Aborting."
exit 1
fi
#Ensure channels are enabled:
errors=0
rhnchanneloutput="$(rhn-channel -l)"
for channel in <%= sat_base_channels %> <%= sat_openstack_channel %>; do
if grep -q "$channel" <<< "$rhnchanneloutput"; then
echo "Found $channel."
else
echo "ERROR: $channel not found. Fix this in RHN Satellite manually or run the following command:"
echo "rhn-channel -a $channel"
((errors++))
fi
done
if [ $errors -gt 0 ]; then
echo "There were problems enabling channels. Please check puppet manifests and your RHN Satellite channel configuration to ensure the necessary channels are enabled." 1>&2
exit 1
fi
<% end %>
#Download packages
mkdir -p <%= pkgdir %>/repodata <%= pkgdir %>/Packages
yum-config-manager --disable 'nailgun' &> /dev/null
yum-config-manager --disable 'centos' --disable 'extras' --disable 'updates' &> /dev/null
yum-config-manager --disable 'base' &> /dev/null
echo "Building initial cache. This may take several minutes."
yum --releasever=<%= releasever %> makecache
#Hack to exclude libqb-0.16.x because it breaks Pacemaker
echo 'exclude=libqb-0.16*' >> /etc/yum.conf
for tries in $(seq 1 <%= numtries %>); do
#Retry if repotrack fails
/usr/local/bin/repotrack -a x86_64,noarch -p "<%= pkgdir %>/Packages" $(cat /etc/nailgun/required-rpms.txt | xargs echo -en) 2>&1 || continue
status=$?
#Purge any corrupt downloaded RPMs
# FIXME: There is a error with a path substitution
# At least hide path if there is no packages.
shopt -s nullglob
before=`ls -1 "<%= pkgdir %>/Packages/" |wc -l`
echo Packages in local repo: $before
env LANG=C rpm --checksig <%= pkgdir %>/Packages/* | grep 'md5 NOT OK' | cut -d':' -f1| xargs rm -f
after=`ls -1 "<%= pkgdir %>/Packages/" |wc -l`
echo Correct packages in local repo: $after
if [ $before -eq $after -a $status -eq 0 ]; then
break
fi
done
if [ $status -ne 0 ]; then
echo "ERROR: Repotrack did not exit cleanly after <%= numtries %> tries." 1>&2
exit 1
fi
if [ $before -ne $after ]; then
echo "ERROR: There are still some packages with broken md5 sum after last (<%= numtries %>) retry to download them." 1>&2
exit 1
fi
rm -f /etc/yum/vars/releasever
yum-config-manager --enable 'nailgun' &> /dev/null
#Disable all RHEL repos so you don't accidentally update and break master node
yum-config-manager --disable '*rhel*' &> /dev/null || :
#Purge Django 1.3 RPM
rm -f <%= pkgdir %>/Packages/Django-1.3*
rpm -i <%= pkgdir %>/Packages/rhel-boot-image-6.4-20130130.0.el6ost.noarch.rpm
mkdir -p /mnt/rhel_iso
mount -o loop /usr/share/rhel-boot-image/rhel-boot-image-6.4-20130130.0.el6ost.iso /mnt/rhel_iso
cp -R /mnt/rhel_iso/. <%= pkgdir %>
umount /mnt/rhel_iso
rpm -e rhel-boot-image-6.4-20130130.0.el6ost.noarch
exit 0