Skip to content

Commit

Permalink
haproxy-devel, Asynchronous XMLRPC sync, and fixed issues due to chan…
Browse files Browse the repository at this point in the history
…ged paths. pkg v 0.38
  • Loading branch information
PiBa-NL committed Jan 17, 2016
1 parent 13c2383 commit 07cdb82
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 54 deletions.
4 changes: 3 additions & 1 deletion net/pfSense-pkg-haproxy-devel/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $FreeBSD$

PORTNAME= pfSense-pkg-haproxy-devel
PORTVERSION= 0.37
PORTVERSION= 0.38
CATEGORIES= net
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down Expand Up @@ -40,6 +40,8 @@ do-install:
${STAGEDIR}${PREFIX}/pkg/haproxy
${INSTALL_DATA} -m 0755 ${FILESDIR}${PREFIX}/pkg/haproxy/haproxy_socket.sh \
${STAGEDIR}${PREFIX}/pkg/haproxy
${INSTALL_DATA} -m 0755 ${FILESDIR}${PREFIX}/pkg/haproxy/haproxy_sync.sh \
${STAGEDIR}${PREFIX}/pkg/haproxy
${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/haproxy/haproxy_gui.inc \
${STAGEDIR}${PREFIX}/pkg/haproxy
${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/haproxy/haproxy_socketinfo.inc \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
]]>
</copyright>
<name>haproxy</name>
<version>0.37</version>
<version>0.38</version>
<title>HAProxy</title>
<aftersaveredirect>/pkg_edit.php?xml=haproxy_pools.php</aftersaveredirect>
<include_file>/usr/local/pkg/haproxy/haproxy.inc</include_file>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
haproxy.inc
Copyright (C) 2013-2015 PiBa-NL
Copyright (C) 2013-2016 PiBa-NL
Copyright (C) 2009 Scott Ullrich <[email protected]>
Copyright (C) 2008 Remco Hoef
All rights reserved.
Expand Down Expand Up @@ -1307,10 +1307,13 @@ function haproxy_check_and_run(&$messages, $reload) {
}
$ok = strstr($retval, "Configuration file is valid");
if ($ok && $reload) {
global $haproxy_run_message;
global $haproxy_run_message, $config;
rmdir_recursive($testpath);
$ok = haproxy_check_run(1) == 0;
$messages = $haproxy_run_message;
if ($ok && isset($config['installedpackages']['haproxy']['enablesync'])) {
mwexec_bg("/usr/local/pkg/haproxy/haproxy_sync.sh");
}
}
return $ok;
}
Expand Down Expand Up @@ -2031,11 +2034,6 @@ function haproxy_writeconf($configpath) {
if ($input_errors) {
require_once("guiconfig.inc");
print_input_errors($input_errors);
} else {
// Only sync to xmlrpc backup machine if no errors are found in config
if (isset($config['installedpackages']['haproxy']['enablesync'])) {
haproxy_do_xmlrpc_sync();
}
}
}

Expand Down Expand Up @@ -2403,7 +2401,7 @@ function haproxy_do_xmlrpc_sync() {
$syncinfo = array();
$syncinfo['sync_logname'] = "HAProxy";
$syncinfo['data'] = haproxy_xmlrpc_sync_prepare_config();
$syncinfo['sync_include'] = "/usr/local/pkg/haproxy.inc";
$syncinfo['sync_include'] = "/usr/local/pkg/haproxy/haproxy.inc";
$syncinfo['sync_done_execute'] = "haproxy_xmlrpc_sync_configure";
xmlrpc_sync_execute($syncinfo);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ $haproxy_icons = array(
'help' => array(
"faicon" => "fa-info-circle",
"icon" => "icon_help.gif",
"iconsize" => 11),
'expand' => array(
"faicon" => "fa-plus-square-o",
"icon" => "plus.gif",
"iconsize" => 11)

);

global $pf_version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class HaproxyHtmlList
if ($editable) {
$itemtype = $item['type'];
if ($itemtype == "select") {
$result .= echo_html_select($itemnamenr, $item['items'], $itemvalue,"-none available-","html_listitem_change(\"{$this->tablename}\",\"{$itemname}\",\"{$counter}\",this);", "width:{$item['size']}");
$result .= echo_html_select($itemnamenr, $item['items'], $itemvalue,"-none available-","html_listitem_change(\"{$this->tablename}\",\"{$itemname}\",\"{$counter}\",this);", "");
} elseif ($itemtype == "checkbox") {
$checked = $itemvalue=='yes' ? " checked" : "";
$result .= "<input onclick='html_listitem_change(\"{$this->tablename}\",\"{$itemname}\",\"{$counter}\",this);' name='$itemnamenr' id='$itemnamenr' type='checkbox'$checked value='yes' />";
Expand Down Expand Up @@ -262,14 +262,10 @@ class HaproxyHtmlList
$result .= "<tr id='tr_viewdetail_$counter'>";
$result .= <<<EOT
<td>
<div style="position:relative;float:right;width:11px;height:11px;">
<div id="htmltable_{$tablename}_{$counter}_details_off" style="position:relative;float:right;width:11px;height:11px;">
<a onclick="htmltable_toggle_details('{$tablename}','{$counter}','htmltable_{$tablename}_{$counter}_details')">
<img id="htmltable_{$tablename}_{$counter}_details_off" alt="Expand advanced server settings"
src="tree/plus.gif" style="clip:rect(19px 13px 30px 2px); top:-19px;position:absolute;"/>
</a>
</div>
</td>
EOT;
EOT
. haproxyicon('expand','Expand advanced server settings') . '</a></div></td>';
$result .= "<td colspan='$colspan'>";
$itemnr = 0;
$result .= "<div id='htmltable_{$tablename}_{$counter}_details_view'>";
Expand Down Expand Up @@ -407,7 +403,7 @@ function haproxy_htmllist_js(){
seltext += "<option value='"+fieldvalueid+"'>"+fieldvalue['name']+"<\/option>";
}

result="<select style='width:" + field['size'] + "' name='" + tableId + field['name'] + rowId +
result="<select name='" + tableId + field['name'] + rowId +
"' id='" + tableId + field['name'] + rowId + "' "+
"onchange='html_listitem_change(\""+tableId+"\",\""+field['name']+"\",\""+rowId+"\",this);' " +
">" + seltext + "<\/select> ";
Expand Down Expand Up @@ -453,46 +449,20 @@ function haproxy_htmllist_js(){
fieldcount += 1;
}
td = d.createElement("td");
td.rowSpan = "1";
//td.setAttribute("class","list");
td.setAttribute("class","action-icons");

// Recreate the button table.
btable = document.createElement("table");
btable.setAttribute("border", "0");
btable.setAttribute("cellspacing", "0");
btable.setAttribute("cellpadding", "1");
btbody = document.createElement("tbody");
btr = document.createElement("tr");

btd = document.createElement("td");
btd.setAttribute("valign", "middle");
btd.innerHTML =
'<input name="'+tableId+'_rowindex[]" id="'+tableId+'_rowindex'+totalrows+'" class="hidden" value="'+totalrows+'" />' +
// Recreate the action icons.
var actions = "";
actions += '<input name="'+tableId+'_rowindex[]" id="'+tableId+'_rowindex'+totalrows+'" class="hidden" value="'+totalrows+'" />' +
'<a onclick="deleteRow(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('delete','delete entry')?></a>";
btr.appendChild(btd);

btd = document.createElement("td");
btd.setAttribute("valign", "middle");
btd.innerHTML = '<a onclick=\"dupRow(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('clone','duplicate entry')?></a>";
btr.appendChild(btd);

actions += '<a onclick=\"dupRow(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('clone','duplicate entry')?></a>";

var tabledefinition = htmllist_get_select_items("tabledefinition", tableId);
if (tabledefinition && tabledefinition['keyfield'] == "") {
btd = document.createElement("td");
btd.setAttribute("valign", "middle");
btd.innerHTML = '<a onclick=\"moveRowUp(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('moveup','move row up')?></a>";
btr.appendChild(btd);

btd = document.createElement("td");
btd.setAttribute("valign", "middle");
btd.innerHTML = '<a onclick=\"moveRowDown(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('movedown','move row down')?></a>";
btr.appendChild(btd);
actions += '<a onclick=\"moveRowUp(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('moveup','move row up')?></a>";
actions += '<a onclick=\"moveRowDown(' + totalrows + ", '" + tableId + "'); return false;\" ><?=haproxyicon('movedown','move row down')?></a>";
}

btbody.appendChild(btr);
btable.appendChild(btbody);
td.appendChild(btable);
td.innerHTML = actions;
tr.appendChild(td);
tbody.appendChild(tr); // add the edit row to the table

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/local/bin/php -f
<?php

require_once('haproxy.inc');
echo "HAProxy Start sync ". (new DateTime('NOW'))->format('c') . "\n";
haproxy_do_xmlrpc_sync();
echo "HAProxy Stop sync ". (new DateTime('NOW'))->format('c') . "\n";

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
&lt;strong&gt;As of pkg v0.33 switched to using 1.6 stable releases.&lt;/strong&gt;]]></descr>
<website>http://haproxy.1wt.eu/</website>
<category>Services</category>
<version>0.37</version>
<version>0.38</version>
<status>RELEASE</status>
<required_version>2.3</required_version>
<config_file>https://packages.pfsense.org/packages/config/haproxy-devel/haproxy.xml</config_file>
Expand Down
1 change: 1 addition & 0 deletions net/pfSense-pkg-haproxy-devel/pkg-plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pkg/haproxy/haproxy_xmlrpcsyncclient.inc
pkg/haproxy/haproxy_htmllist.inc
pkg/haproxy/haproxy_utils.inc
pkg/haproxy/haproxy_socket.sh
pkg/haproxy/haproxy_sync.sh
pkg/haproxy/pkg_haproxy_tabs.inc
pkg/haproxy/haproxy_upgrade_config.inc
www/haproxy/haproxy_listeners.php
Expand Down

0 comments on commit 07cdb82

Please sign in to comment.