aand here they are
for BIND
added-CNFIG-variables-for-BIND.patch (11K) 
added-admin-editing-for-bind-paths.patch (1K)

for Empty zones.include file
Fixed-bug-with-Empty-zonesinclude-file.patch (2K)

sorry for that big thingie,.. i've CodeFormatted sources :(

On Monday, August 27, 2012 11:47:03 AM UTC+3, Paul Rysevets wrote:
>
> I'm really FOR the community fork,.. 
> I, even, saw it but.. that thing didn't even had php_rrd patch in it :(
>
> and there is something wrong with my GitHub commits(to my fork from the 
> original master). i'd like to share my configurable-bind-path.patch 
> (although it's relatively simple)
>
> On Monday, August 27, 2012 10:20:35 AM UTC+3, francesco cislaghi wrote:
>>
>> Hi Arya,
>> about the community fork, a while ago i made a git repo and got an open 
>> source license from atlassian, but i didn't have time to go trough it 
>> lately. If you are interested you can contact me so we can discuss it. 
>> Cheers
>>
>> Il giorno domenica 26 agosto 2012 22:00:21 UTC+2, Arya A. ha scritto:
>>>
>>> Up to you. Btw, I'm 100% for a community fork. The steps to get a 
>>> partially working scalr instance...you weren't kidding when you said 
>>> it's hard.  
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"scalr-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/scalr-discuss/-/VziTZJlg5VcJ.
To post to this group, send email to scalr-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
scalr-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/scalr-discuss?hl=en.

diff --git a/app/cron/class.DNSManagerPollProcess.php b/app/cron/class.DNSManagerPollProcess.php
index 2920ac3..2f00923 100644
--- a/app/cron/class.DNSManagerPollProcess.php
+++ b/app/cron/class.DNSManagerPollProcess.php
@@ -6,63 +6,63 @@
         public $ProcessDescription = "DNS zone manager process (poll method)";
         public $Logger;
         private $authInfo;
-        
+
     	public function __construct()
         {
         	// Get Logger instance
         	$this->Logger = Logger::getLogger(__CLASS__);
         }
-        
+
         public function OnStartForking()
         {
             $db = Core::GetDBInstance();
-            
+
             $this->ThreadArgs = $db->GetAll("SELECT id FROM dns_zones WHERE status NOT IN(?,?) OR (isonnsserver='1' AND status=?)", array(
             	DNS_ZONE_STATUS::ACTIVE,
             	DNS_ZONE_STATUS::INACTIVE,
             	DNS_ZONE_STATUS::INACTIVE
             ));
         }
-        
+
         public function OnEndForking()
         {
             $db = Core::GetDBInstance(null, true);
-            
+
         	$remoteBind = new Scalr_Net_Dns_Bind_RemoteBind();
 
-        	$transport = new Scalr_Net_Dns_Bind_Transports_LocalFs('/usr/sbin/rndc', '/var/named/etc/namedb/client_zones');
+        	$transport = new Scalr_Net_Dns_Bind_Transports_LocalFs(CONFIG::$BIND_PATH, CONFIG::$BIND_ZONES_DIR);
            	$remoteBind->setTransport($transport);
-        	
+
            	$zones = $db->GetAll("SELECT id FROM dns_zones WHERE iszoneconfigmodified = '1'");
            	$s_zones = array();
            	if (count($zones) != 0)
-           	{	
+           	{
            		foreach ($zones as $zone)
 	            {
 	            	$DBDNSZone = DBDNSZone::loadById($zone['id']);
-	            	
+
 		            switch($DBDNSZone->status)
 		           	{
 		           		case DNS_ZONE_STATUS::PENDING_DELETE:
 		           		case DNS_ZONE_STATUS::INACTIVE:
-		           			
+
 		           			$remoteBind->removeZoneFromNamedConf($DBDNSZone->zoneName);
-		           			
+
 		           			break;
-		           			
+
 		           		default:
-		           			
+
 		           			$remoteBind->addZoneToNamedConf($DBDNSZone->zoneName, $DBDNSZone->getContents(true));
 		           			$DBDNSZone->status = DNS_ZONE_STATUS::ACTIVE;
-		           			
+
 		           			break;
 		           	}
-		           	
+
 		           	$s_zones[] = $DBDNSZone;
 	            }
-	            
+
 	            $remoteBind->saveNamedConf();
-	            
+
 	            foreach ($s_zones as $DBDNSZone)
 	            {
 		            if ($DBDNSZone->status == DNS_ZONE_STATUS::PENDING_DELETE)
@@ -73,49 +73,49 @@
 			        		$DBDNSZone->isOnNsServer = 0;
 			        	else
 			        		$DBDNSZone->isOnNsServer = 1;
-			        	
+
 			        	$DBDNSZone->isZoneConfigModified = 0;
 			        	$DBDNSZone->save();
 			        }
 	            }
            	}
-           	
+
            	$remoteBind->reloadBind();
         }
-        
+
         public function StartThread($zone)
         {
             $DBDNSZone = DBDNSZone::loadById($zone['id']);
-            
+
             $remoteBind = new Scalr_Net_Dns_Bind_RemoteBind();
-            
-            $transport = new Scalr_Net_Dns_Bind_Transports_LocalFs('/usr/sbin/rndc', '/var/named/etc/namedb/client_zones');
+
+            $transport = new Scalr_Net_Dns_Bind_Transports_LocalFs(CONFIG::$BIND_PATH, CONFIG::$BIND_ZONES_DIR);
            	$remoteBind->setTransport($transport);
-           	
+
            	switch($DBDNSZone->status)
            	{
            		case DNS_ZONE_STATUS::PENDING_DELETE:
            		case DNS_ZONE_STATUS::INACTIVE:
-           			
+
            			$remoteBind->removeZoneDbFile($DBDNSZone->zoneName);
-           			
+
            			$DBDNSZone->isZoneConfigModified = 1;
-           			
+
            			break;
-           			
+
            		case DNS_ZONE_STATUS::PENDING_CREATE:
            		case DNS_ZONE_STATUS::PENDING_UPDATE:
-           			
+
            			$remoteBind->addZoneDbFile($DBDNSZone->zoneName, $DBDNSZone->getContents());
-           			
+
            			if ($DBDNSZone->status == DNS_ZONE_STATUS::PENDING_CREATE)
            				$DBDNSZone->isZoneConfigModified = 1;
-           				
+
            			$DBDNSZone->status = DNS_ZONE_STATUS::ACTIVE;
-           			
+
            			break;
            	}
-           	
+
            	$DBDNSZone->save();
         }
     }
diff --git a/app/src/structs/struct.CONFIG.php b/app/src/structs/struct.CONFIG.php
index af6dec0..6c18afb 100644
--- a/app/src/structs/struct.CONFIG.php
+++ b/app/src/structs/struct.CONFIG.php
@@ -1,4 +1,4 @@
-<?		
+<?
 	final class CONFIG
 	{
 		public static $DB_DRIVER;
@@ -6,7 +6,7 @@
 		public static $DB_NAME;
 		public static $DB_USER;
 		public static $DB_PASS;
-		
+
 		public static $DEBUG_PROFILING;
 		public static $DEBUG_APP;
 		public static $DEBUG_LEVEL;
@@ -18,18 +18,18 @@
 		 *
 		 * @staticvar string
 		 */
-		
+
 		public static $CRYPTOKEY;
 
 		public static $CRYPTO_ALGO;
-		
+
 		public static $EMAIL_ADDRESS;
-		
+
 		public static $EMAIL_NAME;
 		public static $TEAM_EMAILS;
-		
+
 		/******* DNS ****************/
-		
+
 		public static $DEF_SOA_OWNER;
 		public static $DEF_SOA_TTL = 14400;
 		public static $DEF_SOA_REFRESH = 14400;
@@ -40,32 +40,32 @@
 
 		public static $DNS_TEST_DOMAIN_NAME = 'scalr.ws';
 		public static $SYSDNS_SYSTEM = 0;
-		
+
 		/*******************************/
-		
+
 		public static $EVENTHANDLER_URL;
-		
+
 		public static $SECGROUP_PREFIX;
-		
+
 		public static $EMAIL_DSN;
-				
+
 		public static $NAMEDCONFTPL;
-		
+
 		public static $S3CFG_TEMPLATE;
-		
+
 		public static $SNMPTRAP_PATH;
-		
+
 		/**
 		 * Cache lifetimes
 		 */
 		public static $EVENTS_RSS_CACHE_LIFETIME;
 		public static $EVENTS_TIMELINE_CACHE_LIFETIME;
 		public static $AJAX_PROCESSLIST_CACHE_LIFETIME;
-		
+
 		public static $HTTP_PROTO = "http";
-		
+
 		public static $PMA_INSTANCE_IP_ADDRESS = '184.73.181.141';
-		
+
 		//**** Statistics and monitoring *******//
 		public static $RRDTOOL_PATH;
 		public static $RRD_DEFAULT_FONT_PATH;
@@ -73,22 +73,26 @@
 		public static $RRD_STATS_URL;
 		public static $RRD_GRAPH_STORAGE_TYPE;
 		public static $RRD_GRAPH_STORAGE_PATH;
-		
+
+		//**** BIND PATHS *******//
+		public static $BIND_PATH;
+		public static $BIND_ZONES_DIR;
+
 		public static $MONITORING_TYPE = MONITORING_TYPE::REMOTE;
 		public static $MONITORING_SERVER_URL = 'http://monitoring.scalr.net';
 		public static $MONITORING_GRAPHS_URL = 'https://monitoring-graphs.scalr.net';
-		
+
 		public static $CRON_PROCESSES_NUMBER = 5;
-				
+
 		public static $SYNC_TIMEOUT = 300; // Minutes
-		
+
 		public static $SYNCHRONOUS_SCRIPT_TIMEOUT = 180; // seconds
 		public static $ASYNCHRONOUS_SCRIPT_TIMEOUT = 1200; // seconds
-		
+
 		private static $SCRIPT_BUILTIN_VARIABLES_LOADED = false;
-		private static $SCRIPT_BUILTIN_VARIABLES = array( 
+		private static $SCRIPT_BUILTIN_VARIABLES = array(
 			"image_id" 		=> 1,
-			"role_name" 	=> 1, 
+			"role_name" 	=> 1,
 			"isdbmaster" 	=> 1,
 			"farm_id"		=> 1,
 			"farm_name"		=> 1,
@@ -96,22 +100,22 @@
 			"server_id"		=> 1,
 			"env_id"		=> 1,
 			"env_name"		=> 1,
-		
+
 			//TODO: Remove this vars
 			"ami_id" 		=> 1,
-			"instance_index"=> 1, 
-			"region" 		=> 1, 
+			"instance_index"=> 1,
+			"region" 		=> 1,
 			"avail_zone" 	=> 1,
-			"external_ip" 	=> 1, 
-			"internal_ip" 	=> 1, 
+			"external_ip" 	=> 1,
+			"internal_ip" 	=> 1,
 			"instance_id" 	=> 1
 		);
-		
+
 		public static function getScriptingBuiltinVariables()
 		{
 			foreach (self::$SCRIPT_BUILTIN_VARIABLES as $k=>$v)
 				self::$SCRIPT_BUILTIN_VARIABLES["event_{$k}"] = $v;
-			
+
 			if (!self::$SCRIPT_BUILTIN_VARIABLES_LOADED)
 			{
 				$ReflectEVENT_TYPE = new ReflectionClass("EVENT_TYPE");
@@ -139,9 +143,9 @@
 			    						$events = array(CONFIG::$SCRIPT_BUILTIN_VARIABLES[$k]['EventName']);
 			    					else
 			    						$events = CONFIG::$SCRIPT_BUILTIN_VARIABLES[$k]['EventName'];
-			
+
 			    					$events[] = $event_type;
-			
+
 			    					CONFIG::$SCRIPT_BUILTIN_VARIABLES[$k] = array(
 				    					"PropName"	=> $v,
 				    					"EventName" => $events
@@ -151,13 +155,13 @@
 			    		}
 			    	}
 			    }
-			    
+
 			    CONFIG::$SCRIPT_BUILTIN_VARIABLES_LOADED = true;
 			}
-			
+
 			return CONFIG::$SCRIPT_BUILTIN_VARIABLES;
 		}
-		
+
 		/**
 		 * List all available properties through reflection
 		 * FIXME: Move to parent class Struct, when php will have late static binding
@@ -165,7 +169,7 @@
 		 * @return Array or names
 		 */
 		public static function GetKeys()
-		{ 
+		{
 			$retval = array();
 			$ReflectionClassThis = new ReflectionClass(__CLASS__);
 			foreach($ReflectionClassThis->getStaticProperties() as $Property)
@@ -174,7 +178,7 @@
 			}
 			return($retval);
 		}
-		
+
 		/**
 		 * Get all values
 		 * FIXME: Move to superclass, when php will have late static binding
@@ -186,7 +190,7 @@
 		{
 			return get_class_vars(__CLASS__);
 		}
-		
+
 		/**
 		 * Get value of property by it's name
 		 * FIXME: Move to parent class Struct, when php will have late static binding
@@ -202,11 +206,11 @@
 			{
 				return $ReflectionClassThis->getStaticPropertyValue($key);
 			}
-			else 
+			else
 			{
 				throw new Exception(sprintf(_("Called %s::GetValue('{$key}') for non-existent property {$key}"), __CLASS__));
 			}
 		}
 	}
-	
+
 ?>
\ No newline at end of file
diff --git a/sql/scalr.sql b/sql/scalr.sql
index 8565658..4bbc955 100644
--- a/sql/scalr.sql
+++ b/sql/scalr.sql
@@ -1279,10 +1279,10 @@
   `cloud_location` varchar(25) DEFAULT NULL,
   `image_id` varchar(255) DEFAULT NULL,
   `platform` varchar(25) DEFAULT NULL,
-  `architecture` varchar(25) DEFAULT NULL, 
-  `os_family` varchar(25) DEFAULT NULL, 
-  `os_name` varchar(25) DEFAULT NULL, 
-  `os_version` varchar(25) DEFAULT NULL, 
+  `architecture` varchar(25) DEFAULT NULL,
+  `os_family` varchar(25) DEFAULT NULL,
+  `os_name` varchar(25) DEFAULT NULL,
+  `os_version` varchar(25) DEFAULT NULL,
   `agent_version` varchar(25) DEFAULT NULL,
   PRIMARY KEY (`id`),
   UNIQUE KEY `unique` (`role_id`,`image_id`,`cloud_location`),
@@ -2081,7 +2081,11 @@
 (19, 'http_proto', 'http'),
 (20, 'eventhandler_url', 'example.com'),
 (21, 'cron_processes_number', '5'),
-(22, 'app_sys_ipaddress', '192.168.1.1');
+(22, 'app_sys_ipaddress', '192.168.1.1'),
+
+(23, 'bind_path', '/usr/sbin/rndc'),
+(24, 'bind_zones_dir', '/var/named/etc/namedb/client_zones')
+;
 
 INSERT INTO `roles` (`id`, `name`, `origin`, `client_id`, `env_id`, `description`, `behaviors`, `architecture`, `is_stable`, `history`, `approval_state`, `generation`, `os`, `szr_version`) VALUES
 (16161, 'mysqllvm-centos-5-4', 'SHARED', 0, 0, 'MySQL (v5.0.77) role on CentOS 5.4 i386 EBS', 'mysql', 'i386', 1, '', NULL, 2, 'CentOS 5.4', '0.6.21'),
diff --git a/app/www/ui/js/ui/admin/settings/core.js b/app/www/ui/js/ui/admin/settings/core.js
index 46684bb..66cdfd2 100644
--- a/app/www/ui/js/ui/admin/settings/core.js
+++ b/app/www/ui/js/ui/admin/settings/core.js
@@ -138,6 +138,21 @@
 					name: 'eventhandler_url'
 				}]
 			}]
+		},{
+			xtype: 'fieldset',
+			title: 'BIND settings',
+			defaults: {
+				labelWidth: 300,
+				anchor: '100%',
+				xtype: 'textfield'
+			},
+			items: [{
+				name: 'bind_path',
+				fieldLabel: 'Path to rndc binary'
+			},{
+				name: 'bind_zones_dir',
+				fieldLabel: 'Path to client_zones dir'
+			}]
 		}],
 		dockedItems: [{
 			xtype: 'container',
@@ -167,6 +182,6 @@
 	});
 	if (moduleParams['config'])
 		form.getForm().setValues(moduleParams['config']);
-		
+
 	return form;
 });
\ No newline at end of file
diff --git a/app/src/Scalr/Net/Dns/Bind/Transports/LocalFs.php b/app/src/Scalr/Net/Dns/Bind/Transports/LocalFs.php
index 750682e..e0b8d42 100644
--- a/app/src/Scalr/Net/Dns/Bind/Transports/LocalFs.php
+++ b/app/src/Scalr/Net/Dns/Bind/Transports/LocalFs.php
@@ -2,68 +2,69 @@
 	class Scalr_Net_Dns_Bind_Transports_LocalFs implements Scalr_Net_Dns_Bind_Transport
 	{
 		/**
-		 * 
+		 *
 		 * @var Scalr_Net_Ssh2_Client
 		 */
 		private $rndcPath;
 		private $zonesPath;
-		
+
 		public $host;
-		
+
 		public function __construct($rndcPath, $zonesPath)
 		{
 			$this->logger = Logger::getLogger(__CLASS__);
-			
+
 			$this->shell = new Scalr_System_Shell();
-			
+
 			$this->rndcPath = $rndcPath;
 			$this->zonesPath = $zonesPath;
-					
-			// COunt initial number of zones	
+
+			// COunt initial number of zones
 			$this->zonesCount = $this->rndcStatus();
 			if (!$this->zonesCount)
 				throw new Exception(sprintf(_("Cannot fetch RNDC status on local server")));
 		}
-		
+
 		public function getNamedConf()
 		{
 			$retval = @file_get_contents("{$this->zonesPath}/zones.include");
-			if (!$retval)
-				throw new Exception("Cannot load zones.include file");
+
+			if ($retval === false)
+				throw new Exception("Cannot load {$this->zonesPath}/zones.include file");
 			else
 				return $retval;
 		}
-		
+
 		public function setNamedConf($content)
 		{
 			return file_put_contents("{$this->zonesPath}/zones.include", $content);
 		}
-		
+
 		public function uploadZoneDbFile($zone_name, $content)
 		{
 			return file_put_contents("{$this->zonesPath}/{$zone_name}.db", $content);
 		}
-		
+
 		public function removeZoneDbFile($zone_name)
 		{
 			return unlink("{$this->zonesPath}/{$zone_name}.db");
 		}
-		
+
 		public function rndcReload($zone_name = "")
 		{
 			$retval = $this->shell->queryRaw("{$this->rndcPath} reload {$zone_name}", true);
-			
+
 			$this->logger->info("Execute rndc reload: {$retval}");
 		}
-		
+
 		public function rndcStatus()
 		{
 			$retval = $this->shell->queryRaw("{$this->rndcPath} status", true);
-			
+
 			$this->logger->info("Execute rndc status: {$retval}");
-			
+
 			preg_match_all("/number of zones:[^0-9]([0-9]+)/", $retval, $matches);
-		
+
 			if ($matches[1][0] > 0)
 				return $matches[1][0];
 			else

Reply via email to