Bulk convert Overthere CIFS hosts to SMB hosts & vice-versa using CLI

Follow

Shashank Srivastava -

Scenario

There are times when you have numerous Overthere CIFS hosts & you need to convert them to Overthere SMB hosts. The approach mentioned in https://support.xebialabs.com/hc/en-us/articles/115003642526 is okay if you have only a few hosts. But if you have tens or hundreds of hosts, here is an automated way.  

Environment

XL Deploy

Steps to Perform

Note that the steps 1-3 are the same as described in above mentioned KB article.

1. Download "xld-credential-on-host" Plugin.

You need to download this jar file from below link & place that in your XLD_HOME/plugins directory.

https://github.com/xebialabs-community/xld-credential-on-host-plugin/releases/download/5.0.0/xld-credential-on-host-plugin-5.0.0.jar

2. Clone Smb Converter plugin repository.

Now clone the Smb Converter plugin repository to your XL Deploy server & extract the zip file. It will contain a directory called oc & a README.MD file along with a synthetic.xml file. Copy this oc directory to your XLD_HOME/ext directory. Then add the below synthetic definition to your XLD_HOME/ext/synthetic.xml.

<type-modification type="overthere.SmbHost">
        <method name="ConvertToCifs"
                label="Convert to Cifs"
                delegate="jythonScript"
                description="Convert to Cifs"
                script="oc/converter.py"
        />
    </type-modification>

    <type-modification type="overthere.CifsHost">
        <method name="ConvertToSmb"
                label="Convert to Smb"
                delegate="jythonScript"
                description="Convert to Smb"
                script="oc/converter.py"
        />
    </type-modification>
Please note that you need to add the definition which is mentioned above between already existing opening & closing synthetic tags. 

 3. Restart XL Deploy server.

Now that we have our directory structure & customisations ready, we will now need to restart XL Deploy server to reflect the changes.

4. Execute the getHosts.py script (attached) to prepare a list of CIFS hosts.

We will need a Python list that contains all our CIFS hosts. For better management, I have put all my CIFS hosts inside Infrastructure/WIN directory in XLD.

After exeution of this script, you will get a list. Copy this list as we will need it in our next step.

5. Execute the convertHosts.py (attached) script to perform the bulk conversion.

Before you execute this script, edit the first variable & paste the list which you copied in last step. My test instance has only 6 hosts.

After modifying the script, execute it from XLD CLI.

root@development-server /h/s/X/xl-deploy-7.0.0-cli# ./bin/cli.sh -f /home/shashank/PythonScripts/convertHosts.py -username admin -password PASSWORD

 

Caveats.

Make sure you have arranged your Infrastructure directly & modified line #14 in getHosts.py script accordingly. This will help in filtering out all other hosts except CIFS/SMB ones. Read the script carefully for better understanding.

Please note that this Articles has been tested to work on XL Deploy 7.0.0. From version 7.0.1 onwards, this conversion doesn't work because of bug related to security. This bug has been fixed in an upcoming release (7.5)

Additional Information

Refer to plugin's GitHub Page for more information.

Tags

xl-deploy, how-to, convert, smb, cifs

Have more questions? Submit a request