Jump to content

parameters Override for PreModuleCreate hook


ufovps

Recommended Posts

I am using Virutalizor  provision module. I want to change the network interface type to 'default' when the OS is Windows 2003.

Refer to the hook reference,   PreModuleCreate is what I need.  Here is my hook:

<?php
add_hook('PreModuleCreate', 1, function($vars)
    {
	$newparams=$vars['params'];
	if($newparams['customfields']['OS']=='win-2003-sp2-cn')
	{		
		return array(
           	 'nic_type' => 'default',
        );	
	} 
    }
);

And it doesn't work right. The interface type is still 'virtio', not 'default';

If I want to override the parameter params['configoptions']['nic_type'] with value 'default', what should I do?

 

BTW,  I have dump the vars passed to the hook:

{

    "params": {


        "accountid": 7830, 
        "serviceid": 7830, 
        "addonId": 0, 
        "userid": 871, 
        "domain": "varsdump", 
        "username": "varsdump", 
        "password": "9@kTjH63U)8iZb", 
        "packageid": 999, 
        "pid": 999, 
        "serverid": 1, 
        "status": "Pending", 
        "type": "server", 
        "producttype": "server", 
        "moduletype": "virtualizor", 
        "configoption1": "1 - VMMM", 
        "configoption2": "KVM", 
        "configoption3": "69 - HK-KVM-1", 
        "configoption4": "6 - [G] HK", 
        "configoption5": "", 
        "configoption6": "", 
        "configoption7": "", 
        "configoption8": "", 
        "configoption9": "", 
        "configoption10": "", 
        "configoption11": "", 
        "configoption12": "", 
        "configoption13": "", 
        "configoption14": "", 
        "configoption15": "", 
        "configoption16": "", 
        "configoption17": "", 
        "configoption18": "", 
        "configoption19": "", 
        "configoption20": "", 
        "configoption21": "", 
        "configoption22": "", 
        "configoption23": "", 
        "configoption24": "", 
        "customfields": {


            "noemail": "", 
            "OS": "win-2003-sp2-cn", 
            "vpsid": "", 
            "node_ram_select": ""
        }, 
        "configoptions": {


            "nic_type": "virtio", 
            "Number of IPs": "1"
        }, 
        "model": {


            "id": 78990, 
            "userid": 99, 
            "orderid": 899, 
            "packageid": 509, 
            "server": 1, 
            "regdate": "2018-05-05", 
            "domain": "varsdump", 
            "paymentmethod": "paypal", 
            "firstpaymentamount": "68.00", 
            "amount": "68.00", 
            "billingcycle": "Monthly", 
            "nextduedate": "2018-05-05", 
            "nextinvoicedate": "2018-05-05", 
            "termination_date": "0000-00-00", 
            "completed_date": "0000-00-00", 
            "domainstatus": "Pending", 
            "username": "varsdump", 
            "notes": "", 
            "subscriptionid": "", 
            "promoid": 0, 
            "suspendreason": "", 
            "overideautosuspend": 0, 
            "overidesuspenduntil": "0000-00-00", 
            "dedicatedip": "", 
            "assignedips": "", 
            "ns1": "", 
            "ns2": "", 
            "diskusage": 0, 
            "disklimit": 0, 
            "bwusage": 0, 
            "bwlimit": 0, 
            "lastupdate": "0000-00-00 00:00:00", 
            "created_at": "0000-00-00 00:00:00", 
            "updated_at": "2018-05-05 21:34:23", 
            "serviceProperties": { }, 
            "product": {


                "id": 999, 
                "type": "server", 
                "gid": 12, 
                "name": "HK-CLOUD-1", 
                "description": "· Dual Intel Xeon CPU
· 1 GB DDR3
· 50 GB Raid10
· 2 Mbps 
· Unlimited
· 1  IP", 
                "hidden": 0, 
                "showdomainoptions": 0, 
                "welcomeemail": 17, 
                "stockcontrol": 1, 
                "qty": 284, 
                "proratabilling": 0, 
                "proratadate": 0, 
                "proratachargenextmonth": 0, 
                "paytype": "recurring", 
                "allowqty": 0, 
                "subdomain": "", 
                "autosetup": "payment", 
                "servertype": "virtualizor", 
                "servergroup": 1, 
                "configoption1": "1 - VMMM", 
                "configoption2": "KVM", 
                "configoption3": "69 - HK-KVM-1", 
                "configoption4": "6 - [G] HK", 
                "configoption5": "", 
                "configoption6": "", 
                "configoption7": "", 
                "configoption8": "", 
                "configoption9": "", 
                "configoption10": "", 
                "configoption11": "", 
                "configoption12": "", 
                "configoption13": "", 
                "configoption14": "", 
                "configoption15": "", 
                "configoption16": "", 
                "configoption17": "", 
                "configoption18": "", 
                "configoption19": "", 
                "configoption20": "", 
                "configoption21": "", 
                "configoption22": "", 
                "configoption23": "", 
                "configoption24": "", 
                "freedomain": "", 
                "freedomainpaymentterms": "", 
                "freedomaintlds": "", 
                "recurringcycles": 0, 
                "autoterminatedays": 0, 
                "autoterminateemail": 0, 
                "configoptionsupgrade": 0, 
                "billingcycleupgrade": "", 
                "upgradeemail": 0, 
                "overagesenabled": "", 
                "overagesdisklimit": 0, 
                "overagesbwlimit": 0, 
                "overagesdiskprice": "0.0000", 
                "overagesbwprice": "0.0000", 
                "tax": 0, 
                "affiliateonetime": 10, 
                "affiliatepaytype": "percentage", 
                "affiliatepayamount": "10.00", 
                "order": 1, 
                "retired": 0, 
                "is_featured": 0, 
                "created_at": "2016-03-10 22:06:54", 
                "updated_at": "2018-04-30 19:09:31"
            }, 
            "client": {


                "id": ***, 
                "uuid": "***********", 
                "firstname": "34", 
                "lastname": "34", 
                "companyname": "ufo", 
                "email": "3434@ddd", 
                "address1": "no", 
                "address2": "", 
                "city": "sz", 
                "state": "gd", 
                "postcode": "518000", 
                "country": "CN", 
                "phonenumber": "8998", 
                "authmodule": "", 
                "currency": 1, 
                "defaultgateway": "", 
                "credit": "0.00", 
                "taxexempt": 0, 
                "latefeeoveride": 0, 
                "overideduenotices": 0, 
                "separateinvoices": 0, 
                "disableautocc": 0, 
                "datecreated": "2016-10-02", 
                "notes": "", 
                "billingcid": 0, 
                "securityqid": 0, 
                "groupid": 0, 
                "cardtype": "", 
                "cardlastfour": "", 
                "gatewayid": "", 
                "lastlogin": "2017-03-09 14:16:25", 
                "ip": "183.61.236.94", 
                "host": "183.61.236.94", 
                "status": "Inactive", 
                "language": "english", 
                "emailoptout": 0, 
                "marketing_emails_opt_in": 0, 
                "overrideautoclose": 0, 
                "allow_sso": 1, 
                "email_verified": 0, 
                "created_at": "0000-00-00 00:00:00", 
                "updated_at": "2017-03-09 14:16:25", 
                "fullName": "du du", 
                "countryName": "China"
            }
        }, 
        "server": true, 
        "serverip": "*****", 
        "serverhostname": "****", 
        "serverusername": "***", 
        "serverpassword": "****", 
        "serveraccesshash": "", 
        "serversecure": "on", 
        "serverhttpprefix": "https", 
        "serverport": "", 
        "clientsdetails": {


            "userid": "**", 
            "id": **", 
            "uuid": "****", 
            "firstname": "df", 
            "lastname": "dfadfu", 
            "fullname": "ddfa", 
            "companyname": "ufo", 
            "email": "adfas@lsaf", 
            "address1": "no", 
            "address2": "", 
            "city": "sz", 
            "fullstate": "gd", 
            "state": "gd", 
            "postcode": "518000", 
            "countrycode": "CN", 
            "country": "CN", 
            "phonenumber": "8998", 
            "password": "safdafdsa*****", 
            "statecode": "gd", 
            "countryname": "China", 
            "phonecc": "86", 
            "phonenumberformatted": "+86.8998", 
            "telephoneNumber": "+86.8998", 
            "billingcid": "0", 
            "notes": "", 
            "twofaenabled": false, 
            "currency": "1", 
            "defaultgateway": "", 
            "cctype": "", 
            "cclastfour": "", 
            "gatewayid": "", 
            "securityqid": "0", 
            "securityqans": "", 
            "groupid": "0", 
            "status": "Inactive", 
            "credit": "0.00", 
            "taxexempt": false, 
            "latefeeoveride": false, 
            "overideduenotices": false, 
            "separateinvoices": false, 
            "disableautocc": false, 
            "emailoptout": false, 
            "marketing_emails_opt_in": false, 
            "overrideautoclose": false, 
            "allowSingleSignOn": "1", 
            "language": "english", 
            "lastlogin": "Date: 2017-03-09 14:16<br>IP Address: ****<br>Host: *****", 
            "customfields1": "me", 
            "customfields": [


                {


                    "id": "67899", 
                    "value": "me"
                }, 
                {


                    "id": "99889", 
                    "value": ""
                }
            ], 
            "customfields2": ""
        }
    }
}

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated