Jump to content

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


timnboys

Recommended Posts

really because I am talking about vps provisoning and billing not a vps instead 

also does anyone have a sample provisioning module sdk like whmcs does for blesta?

that I can build ontop of to make a opennebula module?

 

The module docs are here - https://docs.blesta.com/display/dev/Modules

 

And, all modules that ship with Blesta are open, so they serve as good examples. I'd look at one that's most similar to what you're trying to accomplish.

Link to comment
Share on other sites

The module docs are here - https://docs.blesta.com/display/dev/Modules

 

And, all modules that ship with Blesta are open, so they serve as good examples. I'd look at one that's most similar to what you're trying to accomplish.

thanks paul for helping me out to get started on it.

please do find a module I can use for a example to build off of.

Link to comment
Share on other sites

  • 3 months later...

Okay I have made good progress on this and implemented the xmlrpc methods using a php library to handle it all is good except blesta refuses to show my module on my dev blesta.

 

If your module doesn't appear under Settings > Company > Modules > Available, it's probably missing something. If you'd like us to take a look, you can open a ticket and include the module.

Link to comment
Share on other sites

The most common reason for a module to not appear is if it does not follow the file structure pattern, particularly the file name of the module's directory and the main module file (they should match). The second reason is if the file name does not correspond directly to the class name in camel-case.

It appears it was due to my php syntax error.

but I have got another problem now when I try to provision a service it doesn't even look like in opennebula anything was provisioned

Also it just says service has been added and appears active but there isn't nothing in opennebula to show for it and also I don't know if it is another php syntax error on my part but when I try to select a server in the package details it doesn't even list the server I have added(it just gives a blank dropdown box)

is there anyway to log the communication between the module & opennebula to see if maybe the data isn't being passed right or if opennebula doesn't see a parameter right or something?

Link to comment
Share on other sites

have you included tha api call inthe addservice function ?

 

you should check module logs if any errors .

 

what i can really suggest is to make a plain php  file to create the service in openeboula, if it work it would easy to include it in blesta .

well the api call is all in one file(the main file) as it goes down to a function below the addservice function to call the xmlrpc server of opennebula and provision the vm with the provided information passed to the function(to the api call function)

but it doesn't seem like it does anything as I looked on opennebula after running the addservice but there isn't nothing there.

also the module logs are empty.

Link to comment
Share on other sites

well the api call is all in one file(the main file) as it goes down to a function below the addservice function to call the xmlrpc server of opennebula and provision the vm with the provided information passed to the function(to the api call function)

but it doesn't seem like it does anything as I looked on opennebula after running the addservice but there isn't nothing there.

also the module logs are empty.

 

as i suggest again, try to use a standalone file without blesta , to test that the api + your function work .

Link to comment
Share on other sites

Okay I have gotten it working somewhat but is there a way to hook into blesta's addservice method right after the service is created to do "post creation" actions like chown the vm inside opennebula to the user id and then setting the user quota?

all I am basically looking for is to be able to tie into the creation of service process right after the service is created and the service info is saved.

Link to comment
Share on other sites

Why do you need to wait for Blesta to save the service info before you perform additional actions on the VM? You should perform all the actions you need to perform in addService before returning the service fields.

I have figured it out I was trying to use a separate function to handle chowning the permission on opennebula to the user and not oneadmin which is what the module uses to communicate with opennebula's xmlrpc api

and I only wanted to wait until blesta saved the service info so i could get the vpsid and userid from the set of serviceinfo but figured out how to use the variables inside the addservice function to pass the vpsid and userid info to the separate function so that is working now

and yes I pass the vpsid and userid variables inside the addservice function when there created to the separate function that now does the additional required actions and then returns the execution back to the addservice function where it saves the service info finally after doing all of that.

I figured it out right after making the original post on this on how to use the variables that store the vpsid and userid in addservice when there created by the xmlrpc api to pass to the separate actions function so sorry for not updating

as the flow is now addservice creates the vm and user and then passes the execution to the other function with the vpsid and userid variables and then once the other function is done it returns execution back to the addservice function which then saves the service info after completing all the actions needed. 

 

so it now works like this addservice()->otherfunction()->addservice()

so when addservice creates and fills the vpsid and userid variables it then passes execution to otherfunction() which then uses those passed variables to finish up with the vm's and once it is done it passes execution back to addservice() where it saves the service info and is done basically.

Link to comment
Share on other sites

Okay now I have another issue the package fields don't want to show up now.

could one of the blesta dev's or someone point me in the right direction of what I have done wrong in my code of my custom module to cause it and how to fix it?

 

 

you need to work with firebug of Mozilla to check the console result .

Link to comment
Share on other sites

you need to work with firebug of Mozilla to check the console result .

okay I have narrowed it down to the getmodulerowkey method

and I have tried all of the variables in my module and still cannot get it to work and don't remember what I did last time to get it to work.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us" dir="ltr">

    <head>

        <title>Blesta</title>

        <link rel="stylesheet" type="text/css" href="/app/views/errors/css/styles.css" />

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    </head>

    <body>

            <div class="program_error">

        <h3>Oh noes!</h3>

        <div class="contents">

            <p>Undefined property: stdClass::$opennebula.module_row on line <strong>148</strong> in <strong>/var/www/html/app/controllers/admin_packages.php</strong></p>

        </div>

    </div>    </body>

</html>

 

 

please help me as this is one of those I am stuck times and I don't know what I did to cause this.

Link to comment
Share on other sites

okay I have narrowed it down to the getmodulerowkey method

and I have tried all of the variables in my module and still cannot get it to work and don't remember what I did last time to get it to work.

please help me as this is one of those I am stuck times and I don't know what I did to cause this.

Have defined the module_row in the json config file if you use it .

Can you post the function you have error in it ?

Link to comment
Share on other sites

Have defined the module_row in the json config file if you use it .

Can you post the function you have error in it ?

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. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...