Jump to content

Does Blesta Have A Opennebula Billing Module Or Could One Be Made?


Recommended Posts

Posted

No I don't use the json config file I put it in the module class itself.

here is the function:

/**
	 * Returns the key used to identify the primary field from the set of module row meta fields.
	 * This value can be any of the module row meta fields.
	 *
	 * @return string The key used to identify the primary field from the set of module row meta fields
	 */
	public function moduleRowMetaKey() {
		return "server_key";
	}

I don't know if it has existed before in my dev blesta db(and I have changed alot since then) so what do you think it is?

as I cannot pin it down to any function besides the one above when trying to edit/add a package with the module. 

 

 

what you have in addModuleRow() ?

 

normally you should have server_key field saved in database .

Posted

what you have in addModuleRow() ?

 

normally you should have server_key field saved in database .

/**
	 * Adds the module row on the remote server. Sets Input errors on failure,
	 * preventing the row from being added.
	 *
	 * @param array $vars An array of module info to add
	 * @return array A numerically indexed array of meta fields for the module row containing:
	 * 	- key The key for this meta field
	 * 	- value The value for this key
	 * 	- encrypted Whether or not this field should be encrypted (default 0, not encrypted)
	 */
	public function addModuleRow(array &$vars) {
		$meta_fields = array("oneauthstring","one_xmlrpc","hostname");
		$encrypted_fields = array("oneauthstring","one_xmlrpc","hostname");
		
		$this->Input->setRules($this->getRowRules($vars));
		
		// Validate module row
		if ($this->Input->validates($vars)) {

			// Build the meta data for this row
			$meta = array();
			foreach ($vars as $key => $value) {
				
				if (in_array($key, $meta_fields)) {
					$meta[] = array(
						'key' => $key,
						'value' => $value,
						'encrypted' => in_array($key, $encrypted_fields) ? 1 : 0
					);
				}
			}
			
			return $meta;
		}
	}

I have the above in my addmodulerow function.

Posted
/**
	 * Adds the module row on the remote server. Sets Input errors on failure,
	 * preventing the row from being added.
	 *
	 * @param array $vars An array of module info to add
	 * @return array A numerically indexed array of meta fields for the module row containing:
	 * 	- key The key for this meta field
	 * 	- value The value for this key
	 * 	- encrypted Whether or not this field should be encrypted (default 0, not encrypted)
	 */
	public function addModuleRow(array &$vars) {
		$meta_fields = array("oneauthstring","one_xmlrpc","hostname");
		$encrypted_fields = array("oneauthstring","one_xmlrpc","hostname");
		
		$this->Input->setRules($this->getRowRules($vars));
		
		// Validate module row
		if ($this->Input->validates($vars)) {

			// Build the meta data for this row
			$meta = array();
			foreach ($vars as $key => $value) {
				
				if (in_array($key, $meta_fields)) {
					$meta[] = array(
						'key' => $key,
						'value' => $value,
						'encrypted' => in_array($key, $encrypted_fields) ? 1 : 0
					);
				}
			}
			
			return $meta;
		}
	}

I have the above in my addmodulerow function.

 

 

try changing

public function moduleRowMetaKey() {
  return "server_key";
}

to

public function moduleRowMetaKey() {
  return "hostname";
}
Posted

 

try changing

public function moduleRowMetaKey() {
  return "server_key";
}

to

public function moduleRowMetaKey() {
  return "hostname";
}

your a genuis! Thanks for that help as with that help I was able to get it working!

Posted

Just FYI, the method moduleRowMetaKey must return a valid module row meta key used in your module. Your module only defines these values:

$meta_fields = array("oneauthstring","one_xmlrpc","hostname");

i.e. "oneauthstring", "one_xmlrpc", and "hostname"

 

Since "server_key" is not one of these values, it is the cause of the error you encountered.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...