Home > JBoss Fuse > How to add files to a Fuse 6.1 profile using the CLI

How to add files to a Fuse 6.1 profile using the CLI

For some mysterious reason its not possible to upload a file to a profile in Fuse 6.1. Since we tend to script the complete creation and deployment of our Fuse environments we needed to be able to add files to profiles from a script.

The support guys gave me this script that adds a function called ‘import-resource’, and since it really helped us I though I’d share it with the internet:

# Imports resources (ex. xml or properties) into a Fabric Profile
# ex.
# import-resource "TestProfile" "1.0" "something.xml" "/home/jsensharma/Downloads"
# profile-display --display-resources TestProfile

import-resource = {
    _profile = $1
    _version = $2
    _logical_file_path = $3
    _physical_file_path = $4
    _file_content = ((cat file://$_physical_file_path) | tac)
    _sref = $.context getServiceReference "io.fabric8.api.FabricService"
    _srv = $.context getService $_sref
    _dstore = $_srv getdatastore
    $_dstore setFileConfiguration $_version $_profile $_logical_file_path ($_file_content getbytes)

After running this script you’ll be able to upload files like this:

import-resource test-profile 1.0 resource.data /tmp/resource.data
Categories: JBoss Fuse Tags: ,
  1. Eric
    January 31, 2016 at 2:25 pm

    Hi, thanks for your post, can you share where to run the “script” and how to run it? Is it suppose to run in JBoss fuse console?

    • February 1, 2016 at 10:06 am

      Hi Eric, yeah the script has to run in the Fuse shell. You can use the “source” command in the fuse shell to run script files.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: