Working with system file
You can use the REST interface to work with system files on any appliance in a cluster that includes the appliance where you are currently working.
Modifying system files inadequately can impact the proper operation of an appliance.
With system files, you can:
- Retrieve a list of system files
- Download a system file
- Modify a system file
When running an appliance in FIPS-compliant mode, you cannot modify system files.
Retrieving a list of system files
Request formats
<URL>/appliances/<UUID>/system
<URL>/appliances/<UUID>/system?page=<int>&pageSize=<int>
You can retrieve a list of system files from any appliance in a cluster that includes the appliance where you are currently working.
When retrieving a list of system files from an appliance, you append the appliances parameter, the appliance ID, and the system parameter.
You can request a particular page of the feed and specify the page size.
In response to your request, you receive an xml file with all system files listed.
Sample command
Retrieve a list of system files from an appliance in a cluster that includes the appliance where you are currently working:
curl -i -b cookies.txt -X GET "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC/system"
Variable request parameters
Parameter | Type | Description |
---|---|---|
UUID | String | Universally unique identifier for an appliance Default: None |
Page | Integer | Number of a page in a feed with a list of system files Default: 1 |
pageSize | Integer | Size of a page in a feed Default: –1 |
Downloading a system file
Request format
<URL>/appliances/<UUID>/system/<file name>
<URL>/appliances/<UUID>/system/<path>/<file name>
You can download a system file from an appliance in a cluster that includes the appliance where you are currently working.
When downloading a system file from an appliance, you append the appliances parameter and the appliance ID, as well as the path to the system file if there is any and the file name. You must also specify an Accept header.
Using the -o parameter, you can store the downloaded system file as a local file under its name on the appliance where you downloaded it from.
Sample command
Download a system file from an appliance in a cluster that includes the appliance where you are currently working.
curl -b cookies.txt -H "Accept: application/x-download" -X GET "$REST/appliances/081EEDBC-7978-4611-9B96-CB388EEFC4BC/system/hosts" -o hosts.txt
Variable request parameters
Parameter | Type | Description |
---|---|---|
UUID | String | Universally unique identifier for an appliance Default: None |
<path> | String | Path to a system file that is downloaded Default: None |
<file name> | String | Name of a system file that is downloaded Default: None |
Modifying a system file
Request format
<URL>/appliances/<UUID>/system/<file name>
<URL>/appliances/<UUID>/system/<path>/<file name>
You can modify a system file on an appliance in a cluster that includes the appliance where you are currently working.
When running an appliance in FIPS-compliant mode, you cannot modify system files.
When modifying a system file on an appliance, you append the appliances parameter and the appliance ID, as well as the path to the system file if there is any and the file name.
You must also specify a Content-Type header and append a file with the modified data in binary format.
After modifying the system file, you must commit this change using a separate command.
Sample command
Modify a system file on an appliance in a cluster that includes the appliance where you are currently working.
curl -b cookies.txt -H "Content-Type: */*" -X PUT "$REST/appliances /081EEDBC-7978-4611-9B96-CB388EEFC4BC/system/hosts" –d @hosts.txt
Variable request parameters
Parameter | Type | Description |
---|---|---|
UUID | String | Universally unique identifier for an appliance Default: None |
<path> | String | Path to a system file that is modified Default: None |
<file name> | String | Name of a system file that is modified Default: None |
Sample script for working with system files
The following bash script modifies a system file on an appliance in a cluster that includes the appliance where you are currently working.
Before performing this operation, the script sets a URL variable for accessing the REST interface.
Modifying a system file requires running a separate command to commit the modification. Other operations, for example, retrieving a list of system files, do not require a commit.
#!/bin/bash ## Set URL variable for accessing REST interface REST=http://localhost:4711/Konfigurator/REST ## Log on and authenticate curl -i -c cookies.txt -X POST "$REST/login?userName=myUserName&pass=myPassword" ## Modify system file curl -i -b cookies.txt -H "Content-Type: */* -X PUT "$REST/appliances /081EEDBC-7978-4611-9B96-CB388EEFC4BC/system/hosts" –d @hosts.txt ## Commit modification curl -b cookies.txt -X POST "$REST/commit" ## Log off curl -b cookies.txt -X POST "$REST/logout"