The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

/scripts/restorepkg --ip fail

Discussion in 'cPanel Developers' started by dasadmin, Nov 28, 2012.

  1. dasadmin

    dasadmin Registered

    Joined:
    Nov 28, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello, everyone!

    I first just wanted to start off by thanking cPanel for a sweet product that I enjoy using and "admin'ing." I am a system admin at a webhost and have come across a problem and I must reach out to cPanel and the community.

    Essentially, I am working on some automation for account moves, and the problem is when restoring a cPanel package using the --ip=1.2.3.4 argument - the feature seems to fail a lot of the time.

    Quick overview: when restoring an account package with the syntax mentioned below, hypothetically cPanel will restore the account directly onto the IP specified with the --ip argument, as well as install the SSL cert [if any] included in the package:

    Code:
    /scripts/restorepkg --ip=1.2.3.4 /home/cpmove-userna5.tar.gz
    The problem is that this does not always work. I took it upon myself to figure out at least what circumstances determine when --ip will fail, if not exactly why it fails. I will try to explain this as clearly as possible.

    When it will work

    the --ip= option will always work when used during the first account restore after it's initial creation. For example:

    - I create the account userna5 on serverA
    - Add IP 1.2.3.4 to serverA
    - Change userna5's IP to 1.2.3.4
    - Install SSL onto the account userna5

    Then...

    - Package up userna5
    - Send the cpmove file to serverB
    - Remove 1.2.3.4 from serverA, add it to serverB, rearp IP
    - Restore the account on serverB with the following command:

    Code:
    /scripts/restorepkg --ip=1.2.3.4 /home/cpmove-userna5.tar.gz
    SUCCESS!!!

    The account, userna5 has now been successfully restored onto serverB exactly the way that it needs to be. It was installed directly onto 1.2.3.4 along with the SSL. I have tested this process dozens of times and it succeeds without error every single time; however,

    When it fails

    Any subsequent moves from this point will fail!!!

    From now on, any time userna5 is packaged up and moved to another server, "--ip=" will fail. It will restore the account itself; however, the account's IP will be the shared IP and there will be no SSL installed.

    "--ip=" only seems to work for the first subsequent move after the account was created. Once the account has been moved once, no subsequent uses of "--ip=" will work properly.

    Has this happened to you?

    What I am currently doing upon submitting this thread is scouring the files and contents a cpmove file from an account that came to existence via actual account creation and comparing with the files and contents of a cpmove file of an account that came to existence via a prior /scripts/restorepkg.

    If anyone out there has every come across this issue, please shed some light on the scene. Did you ever figure out what variable determines "--ip=" to fail? If so, did you figure out a fix? Is this a bug in cPanel due to improper testing or am I just missing something?

    Furthermore, I implore everyone to try what I'm talking about and see for themselves:

    - Create a new account
    - Change Site's IP to a dedicated IP
    - Install SSL
    - Package it up
    - Restore it with --ip= and see it work
    - Try sending it back or to another server the exact same way you just did it and watch it fail

    My brothers and sisters I am in dire need for clear guidance - endless thanks to all of you who read this and gave thought.
     
  2. dasadmin

    dasadmin Registered

    Joined:
    Nov 28, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    *** Fixed ****


    So instead of despairing over this, I simply took it upon myself to learn how to use the WHM XML API to install the IP/cert [I would have used JSON, but JSON support was not added to python until 2.6 (thanks CentOS 5, you suck)]. Learned a ton and its way more elegant than the whole --ip= route anyway.

    Thanks, all!
     
    #2 dasadmin, Dec 11, 2012
    Last edited: Dec 11, 2012
Loading...

Share This Page