From 508e9b20ce451f243b397397ad6e0c3c029a629f Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Thu, 3 Sep 2009 16:05:33 +0200 Subject: [PATCH] Add RAPI resource to redistribute config Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Luca Bigliardi <shammash@google.com> --- doc/rapi.rst | 16 +++++++++++++++- lib/rapi/connector.py | 1 + lib/rapi/rlib2.py | 11 +++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/rapi.rst b/doc/rapi.rst index e3bfc53fa..d2f7aeade 100644 --- a/doc/rapi.rst +++ b/doc/rapi.rst @@ -190,6 +190,20 @@ Example:: } } + +``/2/redistribute-config`` +++++++++++++++++++++++++++ + +Redistribute configuration to all nodes. + +It supports the following commands: ``PUT``. + +``PUT`` +~~~~~~~ + +Redistribute configuration to all nodes. The result will be a job id. + + ``/2/instances`` ++++++++++++++++ @@ -398,7 +412,7 @@ Example:: Add a set of tags. The request as a list of strings should be ``PUT`` to this URI. The -result willl be a job id. +result will be a job id. It supports the ``dry-run`` argument. diff --git a/lib/rapi/connector.py b/lib/rapi/connector.py index eeae01e58..4f932b0da 100644 --- a/lib/rapi/connector.py +++ b/lib/rapi/connector.py @@ -201,6 +201,7 @@ def GetHandlers(node_name_pattern, instance_name_pattern, job_id_pattern): "/2/tags": rlib2.R_2_tags, "/2/info": rlib2.R_2_info, "/2/os": rlib2.R_2_os, + "/2/redistribute-config": rlib2.R_2_redist_config, } diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py index 63ecf1f6d..345d693c3 100644 --- a/lib/rapi/rlib2.py +++ b/lib/rapi/rlib2.py @@ -116,6 +116,17 @@ class R_2_os(baserlib.R_Generic): return [row[0] for row in diagnose_data if row[1]] +class R_2_redist_config(baserlib.R_Generic): + """/2/redistribute-config resource. + + """ + def PUT(self): + """Redistribute configuration to all nodes. + + """ + return baserlib.SubmitJob([opcodes.OpRedistributeConfig()]) + + class R_2_jobs(baserlib.R_Generic): """/2/jobs resource. -- GitLab