cobbler/cobbler — Issue #54: replicate fails to create profile
Author: pjelar
Created: 2012-01-23 11:21:16+00:00
State: open

When I try to replicate systems from one cobbler host to another it fails to replicate the profile across.

I'm trying to use one cobbler host as the management host and a couple other hosts running cobbler replicating for dns only.

Both hosts are running cobbler-2.0.11-2.el6.noarch

```
cobbler replicate --master 10.85.15.147 --systems=* --omit-data
task started: 2012-01-23_110645_replicate
task started (id=Replicate, time=Mon Jan 23 11:06:45 2012)
cobbler_master = 10.85.15.147
profile_patterns = []
system_patterns = ['*']
omit_data = True
sync_all = False
using CLI defined master
XMLRPC endpoint: http://10.85.15.147/cobbler_api
test ALPHA
test BETA
Querying Both Servers
remote names struct is {'profile': ['centos6'], 'repo': ['epel', 'core', 'base'], 'image': [], 'system': ['dns02', 'mgmt01', 'dns01'], 'distro': ['centos6']}
* Finding Explicit distro Matches
* Finding Explicit profile Matches
* Finding Explicit system Matches
?: seeing if powepgdns02 looks like *
?: seeing if powepgmgmt01 looks like *
?: seeing if powepgdns01 looks like *
* Finding Explicit repo Matches
* Finding Explicit image Matches
* Adding Profiles Required By Systems
?: requires profile: centos6
?: requires profile: centos6
?: requires profile: centos6
* Adding Profiles Required By SubProfiles
* Adding Distros Required By Profiles
Adding repo centos6 for profile centos6.
* Adding Repos Required By Profiles
* Adding Images Required By Systems
?: requires profile: centos6
?: requires profile: centos6
?: requires profile: centos6
transfer list for distro is ['centos6']
transfer list for profile is ['centos6']
transfer list for system is ['dns02', 'mgmt01', 'dns01']
transfer list for repo is ['epel', 'core', 'base']
transfer list for image is []
*NOT* Removing Objects Not Stored On Master
*NOT* Rsyncing Data
Adding Objects Not Stored On Local
adding distro centos6
adding profile centos6
Updating Objects Newer On Remote
Syncing
Exception occured:
Exception value: 'system powepgdns02 references a missing profile centos6'
Exception Info:
File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 95, in run
rc = self._run(self)
File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 210, in runner
self.logger
File "/usr/lib/python2.6/site-packages/cobbler/api.py", line 782, in replicate
sync_all = sync_all
File "/usr/lib/python2.6/site-packages/cobbler/action_replicate.py", line 344, in run
self.api.sync()
File "/usr/lib/python2.6/site-packages/cobbler/api.py", line 611, in sync
return sync.run()
File "/usr/lib/python2.6/site-packages/cobbler/action_sync.py", line 123, in run
self.pxegen.write_all_system_files(x)
File "/usr/lib/python2.6/site-packages/cobbler/pxegen.py", line 226, in write_all_system_files
raise CX("system %(system)s references a missing profile %(profile)s" % { "system" : system.name, "profile" : system.profile})

!!! TASK FAILED !!!
```

Running cobbler list reveals everything has replicated except distros and profiles:

```
cobbler list
distros:

profiles:

systems:
powepgdns01
powepgdns02
powepgmgmt01

repos:
base
core
epel
```
So I manually create the distro and profile:

```
wget http://mirror.bytemark.co.uk/centos/6.1/os/x86_64/isolinux/initrd.img -O /var/lib/cobbler/loaders/centos6_initrd.img
wget http://mirror.bytemark.co.uk/centos/6.1/os/x86_64/isolinux/vmlinuz -O /var/lib/cobbler/loaders/centos6_vmlinuz
cobbler distro add --name centos6 --initrd /var/lib/cobbler/loaders/centos6_initrd.img --kernel /var/lib/cobbler/loaders/centos6_vmlinuz
cobbler profile add --distro centos6 --name centos6 --name-servers "10.85.xx 10.85.xx 10.85.xx" --name-servers-search "other.subdomain.domain.com sub.domain.com domain.com" --repos "base core epel" --kickstart /var/lib/cobbler/kickstarts/default.ks
```

Now I can replicate once with no problems:

```
cobbler replicate --master 10.85.15.147 --systems=* --omit-datatask started: 2012-01-23_111622_replicate
task started (id=Replicate, time=Mon Jan 23 11:16:22 2012)
cobbler_master = 10.85.15.147
profile_patterns = []
system_patterns = ['*']
omit_data = True
sync_all = False
using CLI defined master
XMLRPC endpoint: http://10.85.15.147/cobbler_api
test ALPHA
test BETA
Querying Both Servers
remote names struct is {'profile': ['centos6'], 'repo': ['epel', 'core', 'base'], 'image': [], 'system': ['powepgdns02', 'powepgmgmt01', 'powepgdns01'], 'distro': ['centos6']}
* Finding Explicit distro Matches
* Finding Explicit profile Matches
* Finding Explicit system Matches
?: seeing if powepgdns02 looks like *
?: seeing if powepgmgmt01 looks like *
?: seeing if powepgdns01 looks like *
* Finding Explicit repo Matches
* Finding Explicit image Matches
* Adding Profiles Required By Systems
?: requires profile: centos6
?: requires profile: centos6
?: requires profile: centos6
* Adding Profiles Required By SubProfiles
* Adding Distros Required By Profiles
Adding repo centos6 for profile centos6.
* Adding Repos Required By Profiles
* Adding Images Required By Systems
?: requires profile: centos6
?: requires profile: centos6
?: requires profile: centos6
transfer list for distro is ['centos6']
transfer list for profile is ['centos6']
transfer list for system is ['powepgdns02', 'powepgmgmt01', 'powepgdns01']
transfer list for repo is ['epel', 'core', 'base']
transfer list for image is []
*NOT* Removing Objects Not Stored On Master
*NOT* Rsyncing Data
Adding Objects Not Stored On Local
adding distro centos6
adding profile centos6
Updating Objects Newer On Remote
Linking Distro centos6
Syncing
Done
*** TASK COMPLETE ***
```

If I try to replicate again:

```
cobbler replicate --master 10.85.15.147 --systems=* --omit-data
task started: 2012-01-23_111644_replicate
task started (id=Replicate, time=Mon Jan 23 11:16:44 2012)
cobbler_master = 10.85.15.147
profile_patterns = []
system_patterns = ['*']
omit_data = True
sync_all = False
using CLI defined master
XMLRPC endpoint: http://10.85.15.147/cobbler_api
test ALPHA
test BETA
Querying Both Servers
remote names struct is {'profile': ['centos6'], 'repo': ['epel', 'core', 'base'], 'image': [], 'system': ['powepgdns02', 'powepgmgmt01', 'powepgdns01'], 'distro': ['centos6']}
* Finding Explicit distro Matches
* Finding Explicit profile Matches
* Finding Explicit system Matches
?: seeing if powepgdns02 looks like *
?: seeing if powepgmgmt01 looks like *
?: seeing if powepgdns01 looks like *
* Finding Explicit repo Matches
* Finding Explicit image Matches
* Adding Profiles Required By Systems
?: requires profile: centos6
?: requires profile: centos6
?: requires profile: centos6
* Adding Profiles Required By SubProfiles
* Adding Distros Required By Profiles
Adding repo centos6 for profile centos6.
* Adding Repos Required By Profiles
* Adding Images Required By Systems
?: requires profile: centos6
?: requires profile: centos6
?: requires profile: centos6
transfer list for distro is ['centos6']
transfer list for profile is ['centos6']
transfer list for system is ['powepgdns02', 'powepgmgmt01', 'powepgdns01']
transfer list for repo is ['epel', 'core', 'base']
transfer list for image is []
*NOT* Removing Objects Not Stored On Master
*NOT* Rsyncing Data
Adding Objects Not Stored On Local
Updating Objects Newer On Remote
Linking Distro centos6
Exception occured:
Exception value: global name 'base' is not defined
Exception Info:
File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 95, in run
rc = self._run(self)
File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 210, in runner
self.logger
File "/usr/lib/python2.6/site-packages/cobbler/api.py", line 782, in replicate
sync_all = sync_all
File "/usr/lib/python2.6/site-packages/cobbler/action_replicate.py", line 342, in run
self.link_distros()
File "/usr/lib/python2.6/site-packages/cobbler/action_replicate.py", line 193, in link_distros
print _("- symlink creation failed: %(base)s, %(dest)s") % { "base" : base, "dest" : dest_link }

!!! TASK FAILED !!!
```