Merge lp:~ce-infrastructure/offspring/fix-offspring-dec2011-regressions into lp:offspring

Proposed by Cody A.W. Somerville
Status: Merged
Approved by: Cody A.W. Somerville
Approved revision: 137
Merged at revision: 135
Proposed branch: lp:~ce-infrastructure/offspring/fix-offspring-dec2011-regressions
Merge into: lp:offspring
Diff against target: 190 lines (+50/-20)
5 files modified
lib/offspring/master/scripts/publish_pending_releases.py (+12/-10)
lib/offspring/master/scripts/sync_launchpad_project_milestones.py (+5/-4)
lib/offspring/web/queuemanager/templatetags/lexbuilder_helpers.py (+5/-4)
lib/offspring/web/queuemanager/tests/test_templatetags.py (+26/-0)
setup.py (+2/-2)
To merge this branch: bzr merge lp:~ce-infrastructure/offspring/fix-offspring-dec2011-regressions
Reviewer Review Type Date Requested Status
Timothy R. Chavez Approve
Review via email: mp+102755@code.launchpad.net

Description of the change

This branch fixes a number of regressions that were introduced in late 2011 - how configuration in Offspring was changed but not all consumers of the API were updated and some functions that are console_entry shell scripts (setup tools thing) were moved but setup.py was not updated.

This branch also adds a (simple) test for the link_results templatetag which is responsible for generating the link to build results for the web front-end.

To post a comment you must log in.
Revision history for this message
Timothy R. Chavez (timrchavez) wrote :

Ok...

All web tests passed, ensure the patch covered all places needing to be replaced,

grep "config.web" -R * | wc -l
3
tim@burrito:~/offspring-regressions$ !564
grep "config.publisher" -R * | wc -l
9
tim@burrito:~/offspring-regressions$ !567
grep "config.web" -R * | wc -l
3
tim@burrito:~/offspring-regressions$ bzr merge lp:~ce-infrastructure/offspring/fix-offspring-dec2011-regressions
+N lib/offspring/web/queuemanager/tests/test_templatetags.py
 M lib/offspring/master/scripts/publish_pending_releases.py
 M lib/offspring/master/scripts/sync_launchpad_project_milestones.py
 M lib/offspring/web/queuemanager/templatetags/lexbuilder_helpers.py
 M setup.py
All changes applied successfully.
tim@burrito:~/offspring-regressions$ grep "config.web" -R * | wc -l
0
tim@burrito:~/offspring-regressions$ grep "config.publisher" -R * | wc -l
0
tim@burrito:~/offspring-regressions$ grep "config.web" -R * | wc -l
0

I also ran sync_launchpad_project_milestones.run() from the Django shell without issue.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/offspring/master/scripts/publish_pending_releases.py'
--- lib/offspring/master/scripts/publish_pending_releases.py 2011-06-16 20:21:28 +0000
+++ lib/offspring/master/scripts/publish_pending_releases.py 2012-04-19 19:48:22 +0000
@@ -25,9 +25,11 @@
25 Store25 Store
26)26)
2727
28from offspring import config28from offspring.config import get_configuration
29from offspring.master.models import Release29from offspring.master.models import Release
3030
31config = get_configuration()
32
31def publish_tree(src, dst):33def publish_tree(src, dst):
32 names = os.listdir(src)34 names = os.listdir(src)
33 try:35 try:
@@ -44,25 +46,25 @@
44 # Do not publish development signatures.46 # Do not publish development signatures.
45 continue47 continue
46 elif (srcname.endswith('sums.txt') and 48 elif (srcname.endswith('sums.txt') and
47 os.path.exists(config.publisher("signer_script"))):49 os.path.exists(config.get('publisher', "signer_script"))):
48 # Copy file into signer files directory.50 # Copy file into signer files directory.
49 shutil.copyfile(51 shutil.copyfile(
50 srcname, 52 srcname,
51 os.path.join(config.publisher("signer_files"), name))53 os.path.join(config.get('publisher', "signer_files"), name))
52 # Execute the signer script to have files signed.54 # Execute the signer script to have files signed.
53 os.system(config.publisher("signer_script"))55 os.system(config.get('publisher', "signer_script"))
54 # Remove the file we copied into the signer directory.56 # Remove the file we copied into the signer directory.
55 os.remove(57 os.remove(
56 os.path.join(config.publisher("signer_files"), name))58 os.path.join(config.get('publisher', "signer_files"), name))
57 # Move the signed file to the destination.59 # Move the signed file to the destination.
58 shutil.move(60 shutil.move(
59 os.path.join(61 os.path.join(
60 config.publisher("signer_results"), "%s.asc" % name62 config.get('publisher', "signer_results"), "%s.asc" % name
61 ), "%s.asc" % dstname)63 ), "%s.asc" % dstname)
62 shutil.copyfile(srcname, dstname)64 shutil.copyfile(srcname, dstname)
6365
64def run():66def run():
65 database = create_database(config.publisher("db"))67 database = create_database(config.get('publisher', "db"))
66 store = Store(database)68 store = Store(database)
67 for release in store.find(Release,69 for release in store.find(Release,
68 Release.status == Release.STATUS_PENDING):70 Release.status == Release.STATUS_PENDING):
@@ -71,11 +73,11 @@
71 (release.name, release.build.project))73 (release.name, release.build.project))
72 sys.stdout.flush()74 sys.stdout.flush()
73 images_directory = "%s/images" % release.build.result_directory(75 images_directory = "%s/images" % release.build.result_directory(
74 base_dir=config.publisher('development_pool'))76 base_dir=config.get('publisher', 'development_pool'))
75 project_directory = "%s/project" % release.build.result_directory(77 project_directory = "%s/project" % release.build.result_directory(
76 base_dir=config.publisher('development_pool'))78 base_dir=config.get('publisher', 'development_pool'))
77 release_directory = release.result_directory(79 release_directory = release.result_directory(
78 base_dir=config.publisher('production_pool'))80 base_dir=config.get('publisher', 'production_pool'))
79 # images81 # images
80 if os.path.exists(images_directory):82 if os.path.exists(images_directory):
81 try:83 try:
8284
=== modified file 'lib/offspring/master/scripts/sync_launchpad_project_milestones.py'
--- lib/offspring/master/scripts/sync_launchpad_project_milestones.py 2010-11-30 18:55:17 +0000
+++ lib/offspring/master/scripts/sync_launchpad_project_milestones.py 2012-04-19 19:48:22 +0000
@@ -10,7 +10,7 @@
10from launchpadlib.uris import LPNET_SERVICE_ROOT10from launchpadlib.uris import LPNET_SERVICE_ROOT
11from storm.locals import create_database, Store11from storm.locals import create_database, Store
1212
13from offspring import config13from offspring.config import get_configuration
14from offspring.master.models import (14from offspring.master.models import (
15 LaunchpadProject, 15 LaunchpadProject,
16 LaunchpadProjectMilestone, 16 LaunchpadProjectMilestone,
@@ -19,19 +19,20 @@
1919
20def run():20def run():
21 # Setup connection to launchpad21 # Setup connection to launchpad
22 config = get_configuration()
22 cachedir = os.path.expanduser("~/.launchpadlib/cache/")23 cachedir = os.path.expanduser("~/.launchpadlib/cache/")
23 credentials = Credentials()24 credentials = Credentials()
24 try:25 try:
25 credentials.load(open(config.master("launchpad_oauth")))26 credentials.load(open(config.get("master", "launchpad_oauth")))
26 launchpad = Launchpad(credentials, LPNET_SERVICE_ROOT)27 launchpad = Launchpad(credentials, LPNET_SERVICE_ROOT)
27 except:28 except:
28 launchpad = Launchpad.get_token_and_login(29 launchpad = Launchpad.get_token_and_login(
29 'Offspring Image Build System', LPNET_SERVICE_ROOT, cachedir)30 'Offspring Image Build System', LPNET_SERVICE_ROOT, cachedir)
30 launchpad.credentials.save(31 launchpad.credentials.save(
31 file(config.master("launchpad_oauth"), "w"))32 file(config.get("master", "launchpad_oauth"), "w"))
3233
33 # Setup connection to database34 # Setup connection to database
34 database = create_database(config.master("db"))35 database = create_database(config.get("master", "db"))
35 store = Store(database)36 store = Store(database)
3637
37 for launchpad_project in store.find(LaunchpadProject):38 for launchpad_project in store.find(LaunchpadProject):
3839
=== modified file 'lib/offspring/web/queuemanager/templatetags/lexbuilder_helpers.py'
--- lib/offspring/web/queuemanager/templatetags/lexbuilder_helpers.py 2010-11-29 08:27:24 +0000
+++ lib/offspring/web/queuemanager/templatetags/lexbuilder_helpers.py 2012-04-19 19:48:22 +0000
@@ -6,10 +6,11 @@
6from django import template6from django import template
7from django.template.defaultfilters import stringfilter7from django.template.defaultfilters import stringfilter
88
9from offspring import config9from offspring.config import get_configuration
10from offspring.web.queuemanager.models import Project10from offspring.web.queuemanager.models import Project
11from offspring.slave import LexbuilderSlave11from offspring.slave import LexbuilderSlave
1212
13config = get_configuration()
13register = template.Library()14register = template.Library()
1415
15@register.filter16@register.filter
@@ -17,7 +18,7 @@
17def generate_devel_sourceslist(projectName):18def generate_devel_sourceslist(projectName):
18 try:19 try:
19 project = Project.objects.get(name=projectName)20 project = Project.objects.get(name=projectName)
20 projectArchiveURI = config.web("archive_uri")21 projectArchiveURI = config.get("web", "archive_uri")
21 except:22 except:
22 return ""23 return ""
2324
@@ -44,7 +45,7 @@
44@stringfilter45@stringfilter
45def link_results(projectName, buildName=None):46def link_results(projectName, buildName=None):
46 try:47 try:
47 base_uri = config.web("build_results_uri")48 base_uri = config.get("web", "build_results_uri")
48 except:49 except:
49 return ""50 return ""
5051
@@ -52,7 +53,7 @@
52 try:53 try:
53 date, buildCount = buildName.rsplit("-", 1)54 date, buildCount = buildName.rsplit("-", 1)
54 except:55 except:
55 return config.web("build_results_uri")56 return config.get("web", "build_results_uri")
56 return "%s/%s/%s/%s" % (base_uri, projectName, date, buildCount)57 return "%s/%s/%s/%s" % (base_uri, projectName, date, buildCount)
57 else:58 else:
58 return "%s/%s" % (base_uri, projectName)59 return "%s/%s" % (base_uri, projectName)
5960
=== added file 'lib/offspring/web/queuemanager/tests/test_templatetags.py'
--- lib/offspring/web/queuemanager/tests/test_templatetags.py 1970-01-01 00:00:00 +0000
+++ lib/offspring/web/queuemanager/tests/test_templatetags.py 2012-04-19 19:48:22 +0000
@@ -0,0 +1,26 @@
1# Copyright 2012 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).
3
4from django.test import TestCase
5
6from offspring.config import get_configuration
7from offspring.web.queuemanager.templatetags.lexbuilder_helpers import (
8 link_results,
9)
10
11config = get_configuration()
12
13class LexbuilderHelpersTemplateTagTests(TestCase):
14
15 def test_link_results(self):
16 base_uri = config.get("web", "build_results_uri")
17 project_name = "foobar"
18 build_date = "201202"
19 build_id = "0"
20 expected_link = "%s/%s/%s/%s" % (
21 base_uri, project_name, build_date, build_id)
22 self.assertEqual(
23 link_results(project_name, "%s-%s" % (build_date, build_id)),
24 expected_link)
25
26
027
=== modified file 'setup.py'
--- setup.py 2011-11-11 01:13:02 +0000
+++ setup.py 2012-04-19 19:48:22 +0000
@@ -16,8 +16,8 @@
16 ],16 ],
17 entry_points = {17 entry_points = {
18 'console_scripts': [18 'console_scripts': [
19 '../scripts/cron/build-active-projects = offspring.master:build_active_projects',19 '../scripts/cron/build-active-projects = offspring.master.utils:build_active_projects',
20 '../scripts/cron/process-pending-build-orders = offspring.master:process_pending_build_orders',20 '../scripts/cron/process-pending-build-orders = offspring.master.utils:process_pending_build_orders',
21 '../scripts/cron/publish-pending-releases = offspring.master.scripts.publish_pending_releases:run',21 '../scripts/cron/publish-pending-releases = offspring.master.scripts.publish_pending_releases:run',
22 '../scripts/cron/sync-launchpad-project-milestones = offspring.master.scripts.sync_launchpad_project_milestones:run',22 '../scripts/cron/sync-launchpad-project-milestones = offspring.master.scripts.sync_launchpad_project_milestones:run',
23 '../scripts/offspring-builder-config = offspring.config:print_builder_config',23 '../scripts/offspring-builder-config = offspring.config:print_builder_config',

Subscribers

People subscribed via source and target branches