Re: PATCH: Lua: add UUID to the Proxy Class

2017-10-27 Thread Willy Tarreau
Hi Baptiste,

On Thu, Oct 26, 2017 at 09:59:58PM +0200, Baptiste wrote:
> I saw that the UUID was missing in the Proxy Class in Lua, so I added it.
> The patch is in attachment.

Merged, thanks!

Willy



Re: PATCH: Lua: add UUID to the Proxy Class

2017-10-26 Thread Thierry Fournier
Thanks Baptiste,

This patch will be useful.

Thierry


> On 26 Oct 2017, at 21:59, Baptiste  wrote:
> 
> Hi,
> 
> I saw that the UUID was missing in the Proxy Class in Lua, so I added it.
> 
> The patch is in attachment.
> 
> Baptiste
> <0001-MINOR-lua-add-uuid-to-the-Class-Proxy.patch>




PATCH: Lua: add UUID to the Proxy Class

2017-10-26 Thread Baptiste
Hi,

I saw that the UUID was missing in the Proxy Class in Lua, so I added it.

The patch is in attachment.

Baptiste
From 7fc0433e3f2da0e86bc5ae0cd845856ec23743b7 Mon Sep 17 00:00:00 2001
From: Baptiste Assmann <bed...@gmail.com>
Date: Thu, 26 Oct 2017 21:51:58 +0200
Subject: [PATCH] MINOR: lua: add uuid to the Class Proxy

the proxy UUID parameter is not set in the Lua Proxy Class.
This patches adds it.
---
 doc/lua-api/index.rst | 4 
 src/hlua_fcn.c| 6 ++
 2 files changed, 10 insertions(+)

diff --git a/doc/lua-api/index.rst b/doc/lua-api/index.rst
index 822f8bc..96367f6 100644
--- a/doc/lua-api/index.rst
+++ b/doc/lua-api/index.rst
@@ -823,6 +823,10 @@ Proxy class
 
   Contain the name of the proxy.
 
+.. js:attribute:: Proxy.uuid
+
+  Contain the unique identifier of the proxy.
+
 .. js:attribute:: Proxy.servers
 
   Contain an array with the attached servers. Each server entry is an object of
diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
index 2ae1bbb..9a7e657 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -781,6 +781,12 @@ int hlua_fcn_new_proxy(lua_State *L, struct proxy *px)
 	lua_pushstring(L, px->id);
 	lua_settable(L, -3);
 
+	/* Add proxy uuid. */
+	lua_pushstring(L, "uuid");
+	snprintf(buffer, sizeof(buffer), "%d", px->uuid);
+	lua_pushstring(L, buffer);
+	lua_settable(L, -3);
+
 	/* Browse and register servers. */
 	lua_pushstring(L, "servers");
 	lua_newtable(L);
-- 
2.7.4