Tested this against comps version, works fine, had a bunch of problems with pulp itself (not our interface with it). Finally got that running, pulp manager seems to work as well, so conditional ACK, pending changes below and rebase (if you resend series to list, I should be able to test in <15 minutes now).
On Thu, 2010-09-16 at 15:57 +0200, [email protected] wrote: > From: Jan Provaznik <[email protected]> > > to install pulp: > 1) install pulp packages (described on > https://fedorahosted.org/pulp/wiki/Install) > > 2) create testing repository > $ pulp-admin -u admin -p admin repo create --id jboss --name jboss \ > --feed='yum:http://file.rdu.redhat.com/~imcleod/repos/oddthesis/F11-alternate/noarch/' > \ > --arch=x86_64 > $ pulp-admin -u admin -p admin repo sync --id=jboss > > 3) you should see this repository in template UI on package selection page > --- > src/app/util/image_descriptor_xml.rb | 24 +-- > src/app/util/repository_manager.rb | 165 > ++++---------------- > .../util/repository_manager/abstract_repository.rb | 10 ++ > .../util/repository_manager/comps_repository.rb | 116 ++++++++++++++ > src/app/util/repository_manager/pulp_repository.rb | 73 +++++++++ > src/config/environment.rb | 1 + > .../image_descriptor_package_repositories.yml | 23 ++- > 7 files changed, 257 insertions(+), 155 deletions(-) > create mode 100644 src/app/util/repository_manager/abstract_repository.rb > create mode 100644 src/app/util/repository_manager/comps_repository.rb > create mode 100644 src/app/util/repository_manager/pulp_repository.rb > > diff --git a/src/app/util/image_descriptor_xml.rb > b/src/app/util/image_descriptor_xml.rb > index d9b8348..2509cbf 100644 > --- a/src/app/util/image_descriptor_xml.rb > +++ b/src/app/util/image_descriptor_xml.rb > @@ -51,9 +51,11 @@ class ImageDescriptorXML > end > > def platform=(str) > - # FIXME: we remove all repos beacouse we don't know which one is for > + # FIXME: we remove all repos because we don't know which one is for > # platform > - recreate_repo_nodes(str) > + # update: we don't add platform repo, image builder chooses right one > from OS > + # name, but we add all other repos > + recreate_repo_nodes > node = get_or_create_node('os') > node.content = str > end > @@ -206,19 +208,12 @@ class ImageDescriptorXML > parent << n > end > > - def recreate_repo_nodes(platform) > - unless repconf = platforms[platform] > - raise "unknown platform #{platform}" > - end > - > + def recreate_repo_nodes > repo_node = get_or_create_node('repos') > repo_node.xpath('.//repo').remove > - rnode = get_or_create_node('repo', repo_node) > - rnode.content = repconf['baseurl'] > - > - repository_manager.repositories.each do |rname, repo| > + repository_manager.repositories.each do |repo| > rnode = get_or_create_node('repo', repo_node) > - rnode.content = repo['baseurl'] > + rnode.content = repo.yumurl > end > end > > @@ -246,9 +241,6 @@ class ImageDescriptorXML > end > > def repository_manager > - unless @repository_manager > - @repository_manager = RepositoryManager.new > - end > - return @repository_manager > + @repository_manager ||= RepositoryManager.new > end > end > diff --git a/src/app/util/repository_manager.rb > b/src/app/util/repository_manager.rb > index 05cc5da..1075bf4 100644 > --- a/src/app/util/repository_manager.rb > +++ b/src/app/util/repository_manager.rb <snip> > @@ -170,11 +49,31 @@ class RepositoryManager > def all_packages(repository = nil) > unless @all_packages > @all_packages = [] > - repositories.keys.each do |r| > - next if repository and repository != 'all' and repository != r > - @all_packages += get_repository(r).get_packages > + repositories.each do |r| > + next if repository and repository != 'all' and repository != r.id > + @all_packages += r.packages > end > end > return @all_packages > end > + > + private > + > + def get_repositories > + repositories = [] > + if config > + config.each do |rep| > + if rep['type'] == 'xml' > + repositories << CompsRepository.new(rep) > + elsif rep['type'] == 'pulp' > + repositories += PulpRepository.repositories(rep) > + end > + end > + end > + return repositories > + end > + > + def config > + @config ||= > YAML.load_file("#{RAILS_ROOT}/config/image_descriptor_package_repositories.yml") Note, as I mentioned on irc, this fails if you only have one repo defined in .yml file, since it is not pulled in as an array > + end > end <snip> > diff --git a/src/config/environment.rb b/src/config/environment.rb > index ba14e06..c445f91 100644 > --- a/src/config/environment.rb > +++ b/src/config/environment.rb > @@ -51,6 +51,7 @@ Rails::Initializer.run do |config| > config.gem "compass", :version => ">= 0.10.2" > config.gem "compass-960-plugin", :lib => "ninesixty" > config.gem "simple-navigation" > + config.gem "typhoeus" > > config.active_record.observers = :instance_observer, :task_observer > # Only load the plugins named here, in the order given. By default, all > plugins > diff --git a/src/config/image_descriptor_package_repositories.yml > b/src/config/image_descriptor_package_repositories.yml > index 40335ea..a014bda 100644 > --- a/src/config/image_descriptor_package_repositories.yml > +++ b/src/config/image_descriptor_package_repositories.yml > @@ -1,6 +1,17 @@ > -fedora: > - name: Fedora > - baseurl: > http://download.fedoraproject.org/pub/fedora/linux/releases/11/Everything/x86_64/os/ > -jboss: > - name: JBoss > - baseurl: http://repo.oddthesis.org/cirras/packages/fedora/11/RPMS/noarch/ > +#- When I left this dash in uncommented, I got an error, maybe kill those lines? and just point the commented sample comps repo to the fedora one, that jboss one we had before was just for testing. > +# id: fedora > +# name: Fedora > +# #baseurl: > http://download.fedoraproject.org/pub/fedora/linux/releases/11/Everything/x86_64/os/ > +# baseurl: http://localhost/fedora/ > +# type: xml <snip> > +# > +- > + baseurl: https://admin:ad...@localhost/pulp/api/ > + yumurl: https://localhost/pulp/repos/ > + type: pulp Also, could you include a note in the commit message about how to switch the config? We'll probably need to document it somewhere more easily findable later, but at least this will make it obvious to those follow commits what they would need to switch for now _______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
