In Progress CPANEL-33281 - API - (enqueue_transfer_item) not overrite / force option working

pirulipipi

Member
Dec 24, 2020
5
2
3
Portugal
cPanel Access Level
Root Administrator
Hello cPanel community,

I am experiencing problem using cPanel API enqueue_transfer_item function.

I have 2 cPanels servers, in server one there are 5 accounts, in server two no accounts.
I use API commands for transfer tool and all works fine moving the accounts from server one to server two.
My problem is when I try move second time for rsync/updates the accounts from server one into server two the force also overwrite option is not working it says that

Failed: User “animalsshop2” already exists on this system.
Account “animalsshop2”: User “animalsshop2” already exists on this system.


The API command I am using is:
whmapi1 enqueue_transfer_item transfer_session_id='devcpanelhostcopya20201224184116pWSt' module=AccountRemoteRoot user='animalsshop2' size=1 live_transfer='0' localuser='animalsshop2' overwrite_with_delete='1' --output=json

also I tried:
whmapi1 enqueue_transfer_item module=AccountRemoteRoot user="animalsshop2" transfer_session_id="devcpanelhostcopya20201224184116pWSt" size="1" force="1" live_transfer="0" localuser="animalsshop2" --output=json


Could you help me figure out I cPanel Transfer Tool doenst overwrite account?

I made test using Transfer Tool inside control panel and overwrite/overwrite with delete options works pretty, the problem is only using API commands, maybe command is not passing or cPanel is not recognizing or I am forgetting any variables?
 

Attachments

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
3,224
400
243
cPanel Access Level
Root Administrator
Hey there! I wasn't able to reproduce this issue on my end. I've included the full API calls I used to do this test on my side, with a user that was already present on the Destination server:

Code:
# whmapi1 create_remote_root_transfer_session remote_server_type=cpanel host=domain.com port=22 user=root password=password transfer_threads=1 restore_threads=1 unrestricted_restore=1 copy_reseller_privs=0 compressed=0 unencrypted=0 low_priority=0
---
data:
  analyze_rawout: "Fetching information from remote host: “domain.com” … …\nDone\nFetching information from remote host: “domain.com” … …\nDone\n"
  create_rawout: "Basic credential check … …\nDone\nFetching information from remote host: “domain.com” … …\nDone\nFetching WHM Version …\nDone\nCreating API Token “transfer-1608839841” on “domain.com”. …\n{\"data\":{\"expires_at\":null,\"create_time\":1608839841,\"name\":\"transfer-1608839841\",\"token\":\"7AUDF07VJRW7N9Y6D27JD4DK6TRT3THU\"},\"metadata\":{\"result\":1,\"command\":\"api_token_create\",\"version\":1,\"reason\":\"OK\"}}Done\nTesting “domain.com” for transfer streaming support with password authentication …Streaming Supported\nrsync Supported\nRemote Server Type: WHM1164\n"
  transfer_session_id: domaincomcopya20201224195722fv8b
metadata:
  command: create_remote_root_transfer_session
  reason: OK
  result: 1
  version: 1
 
[[email protected] ~]# whmapi1 enqueue_transfer_item module=AccountRemoteRoot user=cptest localuser=cptest transfer_session_id=domaincomcopya20201224195722fv8b overwrite_with_delete='1'
---
metadata:
  command: enqueue_transfer_item
  reason: OK
  result: 1
  version: 1
 
[[email protected] ~]# whmapi1 start_transfer_session transfer_session_id=domaincomcopya20201224195722fv8b
---
data:
  pid: 6370
metadata:
  command: start_transfer_session
  reason: OK
  result: 1
  version: 1
 
[[email protected] ~]# whmapi1 get_transfer_session_state transfer_session_id=domaincomcopya20201224195722fv8b
---
data:
  state_name: COMPLETED
metadata:
  command: get_transfer_session_state
  reason: OK
  result: 1
  version: 1
Is it possible there was an issue with the session setup that's leading to this error?
 

pirulipipi

Member
Dec 24, 2020
5
2
3
Portugal
cPanel Access Level
Root Administrator
Hey there! I wasn't able to reproduce this issue on my end. I've included the full API calls I used to do this test on my side, with a user that was already present on the Destination server:

Is it possible there was an issue with the session setup that's leading to this error?
Hi mate,

Now I did same commands was you at the end I checked with /usr/local/cpanel/bin/view_transfer and still same error

Code:
[[email protected]]# whmapi1 create_remote_root_transfer_session remote_server_type=cpanel host=dev.hosting.com port=22 user=root sshkey_name=id_rsa transfer_threads=1 restore_threads=1 unrestricted_restore=1 copy_reseller_privs=0 compressed=0 unencrypted=0 low_priority=0
---
data:
  analyze_rawout: "Fetching information from remote host: “devcpanel.hosting.com” … …\nDone\nFetching information from remote host: “devcpanel.hosting.com” … …\nDone\n"
  create_rawout: "Basic credential check … …\nDone\nFetching information from remote host: “devcpanel.hosting.com” … …\nERROR: /bin/bash: line 7: export: `é': not a valid identifier\nERROR: /bin/bash: line 15: export: `é': not a valid identifier\nDone\nFetching WHM Version …\nDone\nCreating API Token “transfer-1608847065” on “devcpanel.hosting.com”. …\n{\"metadata\":{\"result\":1,\"command\":\"api_token_create\",\"version\":1,\"reason\":\"OK\"},\"data\":{\"expires_at\":null,\"token\":\"HUZLTGGTUJCTVO7ORKNQBOP06K7CCLLA\",\"create_time\":1608847065,\"name\":\"transfer-1608847065\"}}Done\nTesting “devcpanel.hosting.com” for transfer streaming support with accesshash authentication …Streaming Supported\nrsync Supported\nRemote Server Type: WHM1164\n"
  transfer_session_id: devcpanelhostcopya20201224215746asp8
metadata:
  command: create_remote_root_transfer_session
  reason: OK
  result: 1
  version: 1
[[email protected]]# whmapi1 enqueue_transfer_item module=AccountRemoteRoot user=animalsshop2 localuser=animalsshop2 transfer_session_id=devcpanelhostcopya20201224215746asp8 overwrite_with_delete='1'
---
metadata:
  command: enqueue_transfer_item
  reason: OK
  result: 1
  version: 1
[[email protected]]# whmapi1 start_transfer_session transfer_session_id=devcpanelhostcopya20201224215746asp8
---
data:
  pid: 2023826
metadata:
  command: start_transfer_session
  reason: OK
  result: 1
  version: 1
[[email protected]]# whmapi1 get_transfer_session_state transfer_session_id=devcpanelhostcopya20201224215746asp8
---
data:
  state_name: COMPLETED
metadata:
  command: get_transfer_session_state
  reason: OK
  result: 1
  version: 1
[[email protected]]# /usr/local/cpanel/bin/view_transfer devcpanelhostcopya20201224215746asp8
The transfer for session ID “devcpanelhostcopya20201224215746asp8” is complete.
[202382][MASTER    ]: Start Session
[202382][MASTER    ]: Version: 2.3
[202382][MASTER    ]: Queue “TRANSFER” items: 1
[202382][MASTER    ]: Queue “RESTORE” items: 1
[202382][MASTER    ]: Remote Host: dev.hosting.com
[202382][TRANSFER:1]: Starting “Account”: animalsshop2
[202382][TRANSFER:1][A:animalsshop2    ]: Progress: 0% (2020-12-24 21:59:16 +0000)
[202382][TRANSFER:1][A:animalsshop2    ]: Starting “TRANSFER” for “Account” “animalsshop2”.
[202382][TRANSFER:1][A:animalsshop2    ]: Progress: 100% (2020-12-24 21:59:16 +0000)
[202382][TRANSFER:1][A:animalsshop2    ]: Failed: User “animalsshop2” already exists on this system.
[202382][TRANSFER:1]: Account “animalsshop2”: User “animalsshop2” already exists on this system.
[202382][TRANSFER:1]: Progress: 100% (2020-12-24 21:59:16 +0000)
[202382][RESTORE:1 ][A:animalsshop2    ]: Starting “RESTORE” for “Account” “animalsshop2”.
[202382][RESTORE:1 ][A:animalsshop2    ]: Failed: User “animalsshop2” already exists on this system.
[202382][RESTORE:1 ]: Account “animalsshop2”: User “animalsshop2” already exists on this system.
[202382][RESTORE:1 ]: Progress: 100% (2020-12-24 21:59:16 +0000)
[202382][TRANSFER:1]: Child Complete
[202382][RESTORE:1 ]: Child Complete
[202382][MASTER    ]: Session Complete
[[email protected]]#
 

pirulipipi

Member
Dec 24, 2020
5
2
3
Portugal
cPanel Access Level
Root Administrator
I received feedback from support team after opening ticket.
Seems to be a error in API since or before version 88.
Thank you for your help CPRex ;)


Description


It has been brought to our attention that when using our API the variables force, skipaccount, and overwrite_with_delete are not allowing an existing account to be overwritten in cPanel version 88. A case has been filed and our developers are currently looking into this behavior.



For reference, the case number is CPANEL-33281. Follow this article to receive an email notification when a solution is published in the product.



Workaround


Until a resolution has been published, you will need to utilize the WHM interface 'Home »Transfers »Transfer Tool' to transfer existing accounts.