Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Error trying to use Whost::XMLUI::cPanel::cpanel_exec

Discussion in 'cPanel Developers' started by mkly, Mar 15, 2014.

  1. mkly

    mkly Registered

    Joined:
    Mar 12, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    In post Accounts::Create hook I have this code where $user is the user just created and $dbname is just a test name at this point
    Code:
            Whostmgr::XMLUI::cPanel::cpanel_exec({
                            'cpanel_xmlapi_module' => 'Mysql',
                            'cpanel_xmlapi_func' => 'adddb',
                            'cpanel_xmlapi_apiversion' => 1,
                            'cpanel_xmlapi_user' => $user,
                            'arg-0' => $dbname
                    },
                    undef,
                    1
            );
    
            Whostmgr::XMLUI::cPanel::cpanel_exec({
                            'cpanel_xmlapi_module' => 'Mysql',
                            'cpanel_xmlapi_func' => 'adduser',
                            'cpanel_xmlapi_apiversion' => 1,
                            'cpanel_xmlapi_user' => $user,
                            'arg-0' => $dbuser,
                            'arg-1' => 's3crEt!'
                    },
                    undef,
                    1
            );
    
    Results in the database being created but the database user not being created

    Code:
    [2014-03-15 19:00:39 -0400] info [cpmysql] Creating MySQL virtual user t2user_tdb for user t2user
    [2014-03-15 19:00:39 -0400] warn [servers_queue] Cannot queue task mysqluserstore ( no id, probably a duplicate ) at /usr/local/cpanel/Cpanel/LoggerAdapter.pm line 26
    	Cpanel::LoggerAdapter::warn(Cpanel::LoggerAdapter=HASH(0x1e64580), 'Cannot queue task mysqluserstore ( no id, probably a duplicate )') called at /usr/local/cpanel/bin/servers_queue line 90
    	main::queue_tasks('mysqluserstore') called at /usr/local/cpanel/bin/servers_queue line 75
    
    The part that seems strange is that main::queue_tasks() does not appear to be getting the arg-0 and arg-1 parameters I'm passing into the second cpanel_exec.

    Any ideas?
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,435
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Feel free to submit this as a bug report so we can attempt to reproduce the issue and verify if it's a flaw with the API:

    Submit A Bug Report

    Post the ticket number here and we can update this thread with the outcome.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice