LGTM, thanks.
On Mon, Oct 7, 2013 at 6:39 PM, Klaus Aehlig <[email protected]> wrote: > The 'gnt-cluster upgrade --resume' command needs to determine whether the > configuration has already been updated or not, in order to decide at which > phase to resume. So provide a function to determine the version of the > configuration on file. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > lib/client/gnt_cluster.py | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py > index 6eeb4fc..0eb23ea 100644 > --- a/lib/client/gnt_cluster.py > +++ b/lib/client/gnt_cluster.py > @@ -45,6 +45,7 @@ from ganeti import compat > from ganeti import netutils > from ganeti import ssconf > from ganeti import pathutils > +from ganeti import serializer > from ganeti import qlang > > > @@ -1746,6 +1747,22 @@ def _ExecuteCommands(fns): > fn() > > > +def _GetConfigVersion(): > + """Determine the version the configuration file currently has. > + > + @rtype: tuple or None > + @return: (major, minor, revision) if the version can be determined, > + None otherwise > + > + """ > + config_data = > serializer.LoadJson(utils.ReadFile(pathutils.CLUSTER_CONF_FILE)) > + try: > + config_version = config_data["version"] > + except KeyError: > + return None > + return utils.SplitVersion(config_version) > + > + > def _ReadIntentToUpgrade(): > """Read the file documenting the intent to upgrade the cluster. > > -- > 1.8.4 > > -- Thomas Thrainer | Software Engineer | [email protected] | Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
