On 06/04/2013 09:19 AM, Stephen Gallagher wrote: > On 06/04/2013 09:15 AM, victoria wrote: >> >> >> On Tue, Jun 4, 2013 at 1:47 PM, Stephen Gallagher >> <[email protected] <mailto:[email protected]>> wrote: >> >> On 06/04/2013 05:47 AM, Christian Hammond wrote: >> > On Jun 4, 2013, at 2:44 AM, Stephen Gallagher >> <[email protected] <mailto:[email protected]> >> > <mailto:[email protected] >> <mailto:[email protected]>>> wrote: >> > >> >> >> >> >> >> On Tuesday, June 4, 2013, pfee wrote: >> >> >> >> Hi Christian, Stephen, >> >> >> >> While testing Stephen's Fedora packages, on a F18 machine I >> >> upgraded from 1.7.7.1 to 1.7.9. Following the upgrade, I >> expected >> >> visiting the site's /dashboard URL would have told me to run >> >> "rb-site upgrade". Instead I got a 500 "Something broke..." >> message. >> >> >> >> Despite not being prompted, I ran "rb-site upgrade >> >> /var/www/reviewboard" anyway. The site came back to life and >> >> started working again as expected, however someone upgrading for >> >> the first time would not know to do this. >> >> >> >> >> >> Ah, thanks for reminding me. Not that anyone actually reads the >> >> updates notes, but I usually put a reminder in that you always >> need to >> >> run rb-site upgrade after installing the packages. I'll tweak the >> >> update notes when I get to work. >> >> >> >> I've been meaning to patch the Fedora packages to do this >> >> automatically, by having rb-site install save a config file with a >> >> list of installed sites so I can have the %post script run the >> upgrade >> >> on package install. >> > >> > I've actually been wanting such a file for Review Board upstream that >> > rb-site can write to, so that we can be more intelligent about >> upgrades. >> > If you come up with a good way to do it, let me know :) >> > >> >> >> Has Review Board formally and without question dropped Windows support? >> If so, it becomes reasonably easy to hardcode a requirement on a file >> such as /etc/ReviewBoard/sites which could be as simple as >> one-path-per-line, and then patch rb-site to amend it when doing an >> install and to iterate through it when calling 'rb-site upgrade' with no >> arguments. >> >> Then all I would have to do in the Fedora packages is call 'rb-site >> upgrade' in the %post section on upgrades. >> >> >> >> Just a comment from BitNami. Even if Windows is not supported it would >> be great you don't have any path hardcoded. Currently we allow to have >> different installations in the systems in different installation paths, >> installing as root as an not root user. Of course this is also possible >> without using the BitNami installers. Having that hardcoded will affect >> this flexibility. If those are necessary I would suggest to have default >> values..but not hardcoded and not customizables values. >> > > Yeah, the same thought occurred to me a few minutes ago. I may just try > to make it a variable in settings.py or something, defaulting to > /etc/ReviewBoard, unless Christian or David has a better idea. >
Ok, I have a first pass at implementing this, by adding a new option to rb-site (--sitelist) which will default to /etc/ReviewBoard/sites I've modified the upgrade routine so that it can be called as 'rb-site upgrade' with no site listed, at which point it will iterate through the sites listed in /etc/ReviewBoard/sites and upgrade them all. I'm sending these as attached git-format-patch patches because the reviews.reviewboard.org website appears to be broken at the moment. -- Want to help the Review Board project? Donate today at http://www.reviewboard.org/donate/ Happy user? Let us know at http://www.reviewboard.org/users/ -~----------~----~----~----~------~----~------~--~--- To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/reviewboard?hl=en --- You received this message because you are subscribed to the Google Groups "reviewboard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
>From fb9e7feb6e239c9a37b2fe5316fa9a328938c0c3 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher <[email protected]> Date: Tue, 4 Jun 2013 14:47:38 -0400 Subject: [PATCH 1/2] Store installation paths to sitelist file during 'rb-site install' --- reviewboard/cmdline/rbsite.py | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/reviewboard/cmdline/rbsite.py b/reviewboard/cmdline/rbsite.py index b3b4af61731abba99273b8eae566e1de7efd193f..7bd60c3e4ff926a5d4e786beaba97cb6478ebef4 100755 --- a/reviewboard/cmdline/rbsite.py +++ b/reviewboard/cmdline/rbsite.py @@ -18,6 +18,7 @@ from reviewboard import get_version_string DOCS_BASE = "http://www.reviewboard.org/docs/manual/dev/" +SITELIST_FILE_UNIX = "/etc/ReviewBoard/sites" # See if GTK is a possibility. try: @@ -629,6 +630,38 @@ class Site(object): fp.write(template) fp.close() +class SiteList(object): + def __init__(self, path): + self.path = path + + # Read the list in as a set of keys for a dictionary + # This way, we can easily eliminate duplicates + self.sites = {} + + if os.path.exists(self.path): + f = open(self.path) + + for line in f: + site = line.strip() + + # Verify that this path exists on the system + # And add it to the dictionary + if os.path.exists(site): + self.sites[site] = None + f.close() + + def add_site(self, site_path): + self.sites[site_path] = None + + # Write all of the sites back to the file + # Sort keys to ensure consistent order + sites = self.sites.keys() + sites.sort() + + f = open(self.path, "w+") + for site in sites: + f.write("{0}\n".format(site)) + f.close() class UIToolkit(object): """ @@ -1372,6 +1405,13 @@ class InstallCommand(Command): group.add_option("--admin-email", help="the site administrator's e-mail address") + # UNIX-specific arguments + if not isWin: + group.add_option("--sitelist", + default=SITELIST_FILE_UNIX, + help="the path to a file storing a list of " + "installed sites") + parser.add_option_group(group) def run(self): @@ -1401,6 +1441,7 @@ class InstallCommand(Command): self.ask_web_server_type() self.ask_python_loader() self.ask_admin_user() + # Do not ask for sitelist file, it should not be common self.show_install_status() self.show_finished() @@ -1742,6 +1783,15 @@ class InstallCommand(Command): siteconfig.set("site_admin_email", site.admin_email) siteconfig.save() + isWin = (platform.system() == "Windows") + if not isWin: + abs_sitelist = os.path.abspath(site.sitelist) + # Add the site to the sitelist file + sys.stdout.write("Saving site {0} to the sitelist {1}\n".format( + site.install_dir, abs_sitelist)) + sitelist = SiteList(abs_sitelist) + sitelist.add_site(site.install_dir) + class UpgradeCommand(Command): """ -- 1.8.2.1
>From 2864d3fb63871d57e9e4854689429eae4965a6d4 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher <[email protected]> Date: Tue, 4 Jun 2013 15:19:01 -0400 Subject: [PATCH 2/2] Allow upgrading all configured sites at once --- reviewboard/cmdline/rbsite.py | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/reviewboard/cmdline/rbsite.py b/reviewboard/cmdline/rbsite.py index 7bd60c3e4ff926a5d4e786beaba97cb6478ebef4..12627824d9cdf5e0b13ad635f5a0222c883c732a 100755 --- a/reviewboard/cmdline/rbsite.py +++ b/reviewboard/cmdline/rbsite.py @@ -663,6 +663,9 @@ class SiteList(object): f.write("{0}\n".format(site)) f.close() + def get_sites(self): + return self.sites.keys() + class UIToolkit(object): """ An abstract class that forms the basis for all UI interaction. @@ -1956,36 +1959,45 @@ def parse_options(args): options.force_console = True # We expect at least two args (command and install path) - if len(args) < 2 or args[0] not in COMMANDS.keys(): + if args[0] not in COMMANDS.keys() or (len(args) < 2 and args[0] != 'upgrade'): parser.print_help() sys.exit(1) command = args[0] - install_dir = args[1] + + # Check whether we've been asked to upgrade all installed sites + # by 'rb-site upgrade' with no path specified + if len(args) < 2 and args[0] == 'upgrade': + sitelist = SiteList(options.sitelist) + install_dirs = sitelist.get_sites() + else: + install_dirs = [args[1]] globals()["args"] = args[2:] - return (command, install_dir) + return (command, install_dirs) def main(): global site global ui - command_name, install_dir = parse_options(sys.argv[1:]) + command_name, install_dirs = parse_options(sys.argv[1:]) command = COMMANDS[command_name] - site = Site(install_dir, options) - os.putenv('HOME', os.path.join(site.install_dir, "data")) + for install_dir in install_dirs: + site = Site(install_dir, options) - if command.needs_ui and can_use_gtk and not options.force_console: - ui = GtkUI() + os.putenv('HOME', os.path.join(site.install_dir, "data")) - if not ui: - ui = ConsoleUI() + if command.needs_ui and can_use_gtk and not options.force_console: + ui = GtkUI() - command.run() - ui.run() + if not ui: + ui = ConsoleUI() + + command.run() + ui.run() if __name__ == "__main__": -- 1.8.2.1
