SCMI Example - Linux Filesystem
This section provides a detailed, step-by-step example of how SCMI is used to integrate with Krugle Enterprise through SSH. This example uses Python to implement an SCMI integration to the Linux file system. This script allows Krugle Enterprise to crawl and index all files at (and beneath) a specified root directory. The script to perform this integration is available from Krugle, and as the instructions below show, this sample script requires only several edits and configuration steps to be operational.
Note
SCMI can be used to integrate Krugle Enterprise with other SCM systems, on other operating systems (Windows), using different scripting languages (Perl, .net, etc.) and different communication protocols. This example illustrates just one possible configuration option.
1. Verify SCMI host configuration (example: linux).
1a. Verify that Python 2.3 (or later) is configured on the SCMI host. To test this, execute a shell command that will confirm the presence of python - e.g. :
> python -V
1b. Verify that SSH is available on the SCMI host. Execute a test command such as the following:
> ps ax |grep sshd
2. Access the SCMI template script.
- Navigate to Krugle Filesystem Connector.
- Click the download link to get the latest version of the connector, after reviewing the release notes.
- Unpack the Krugle-SCMI-Examples archive and place the contents of the python folder in a directory; note the name for use in subsequent steps, e.g.
/home/krugle_scmi/scripts
- Make sure that the SCMI script is executable on the SCMI host; the following command should return to the shell without error:
> chmod u+x gateway-filesystem.py
3. Edit gateway-filesystem.py
- Enter the host name of the SCMI host (italicized in the sample line below). If the SCMI host has a static IP address, you can enter the address or a domain name that can be resolved to an IP address on the network that the SCMI host is connected to.
“host” : “your_host_name”
- Enter the root location of the SCMI working directory. Using the locations from 2c above “rootScmiPath” : /home/krugle_scmi
- Save changes to gateway-filesystem.py
4. Verify proper access and operation of the SCMI script.
On the SCMI host machine, in the scripts directory (from step 2c above) open test-files-req.xml and type in:
<files-request version=”1”> <project> <serverUid>default</serverUid> <projectUid>krugle-fs-test</projectUid> <location>/bin/</location> <params></params> </project> </files-request>
Save the edits to the file and test the SCMI script from the shell:
> cat test-files-req.xml | ./gateway-filesystem.py
The stdout response should be XML formatted in a files-response. Once it is verified that the SCMI script operates properly from the SCMI host, test the script over the network. First copy the test-files-req.xml over to another machine, and then from that machine:
> cat test-files-req.xml | ssh@ /absolute/path/to/executable
5. Identify the root directory of code files that you want crawled by Krugle Enterprise
For this example we assume that the code is located: /code_files
6. Setup a Project in Krugle Enterprise to crawl and index the code files
- Sign in to the Krugle Enterprise Hub.
- Create a new project. Click the projects tab. Click “Add New Project”. Add required project metadata.
- Under the “Add SCM location to project definition” section, select create new repository from the dropdown list.
- Choose SCMI from the SCM type and enter the host name that was specified in step 3a above. Click Next.
- On the SCMI detail screen, provide a name for the Repository; specify the path to the SCMI working directory - for this example, this is the path specified in step 3b above. Specify the connection type as SSH. Click Save.
- In the “Add SCM location to project definition” section, specify the path location from step 4 above. Click Add.
This completes the setup. Krugle Enterprise will crawl and index the code located at the path specified in step 4. Within several minutes, the code will be available for client searching.