Red Hat Training

A Red Hat training course is available for Red Hat Fuse

9.42. fabric:profile-edit

Abstract

edits the specified version of the specified profile (where the version defaults to the current default version)

Synopsis

fabric:profile-edit [ --help ] [[ -p ] | [ --pid ]PID] [[ -r ] | [ --repository ] | [ -f ] | [ --feature ] | [ -b ] | [ --bundle ] | [ -c ] | [ --config ] | [ -s ] | [ --system ] | [ -o ] | [ --overrides ] | [ -l ] | [ --lib ] | [ -n ] | [ --endorsed ] | [ -x ] | [ --extension ]] [[ --set ] | [ --delete ]] [[ --append ] | [ --remove ]] [ --import-pid ] [[ --delimiter ]delim] [[ --resource ]ResourceName] { Profile } [ Version ]

Description

In the specified profile, you can edit different kinds of settings, as follows:
  • Feature repository locations—to add a feature repository to the profile, enter a command in the following format:
    fabric:profile-edit --repository RepoURL Profile [Version]
    For example, to add the fuse-fabric feature repository to the profile, enter a command like the following:
    fabric:profile-edit --repository mvn:io.fabric8/fuse-fabric/6.3.0.redhat-xxx/xml/features Profile [Version]
    To delete repositories, enter a command of the following form:
    fabric:profile-edit --delete --repository RepoURL Profile [Version]
    To edit repository locations directly, using a visual text editor, enter the following command:
    fabric:profile-edit Profile [Version]
    The visual editor opens, showing the contents of the specified profile's agent properties. To edit the repository settings, add, modify, or delete lines of the following form:
    repository.ID=URL
    Where ID is an arbitrary unique identifier and URL gives the location of a single feature repository. Only one repository URL can be specified on each line.
  • Features to install—to add features to the profile, enter a command in the following format:
    fabric:profile-edit --feature FeatureName Profile [Version]
    To add multiple features, you can specify the --feature flag multiple times in this command. For example, to add the camel-jetty and the camel-quartz features to the default version of the sample profile, enter a command like the following:
    fabric:profile-edit --feature camel-jetty --feature camel-quartz sample
    To delete features, enter a command of the following form:
    fabric:profile-edit --delete --feature FeatureName Profile [Version]
    To edit features directly, using the visual text editor, enter the following command:
    fabric:profile-edit Profile [Version]
    The visual editor opens, showing the contents of the specified profile's agent properties. To edit the features, add, modify, or delete lines of the following form:
    feature.ID=FeatureName
    Where ID is an arbitrary unique identifier and FeatureName is the name of a feature.
  • Bundles to install—to add bundles to the profile, enter a command in the following format:
    Note
    The fabric:profile-edit command supports two flag variations for specifying bundles—--bundle and --bundles. The --bundles flag is included for backwards compatibility. Regardless of which variation you use, to specify multiple bundles on the same command line, you must include the flag with each bundle specification.
    fabric:profile-edit --bundle BundleURL Profile [Version]
    For example, to add camel-quartz bundle to the sample profile, enter a command like the following:
    fabric:profile-edit --bundle mvn:org.apache.camel/camel-quartz/2.17.0.redhat-630xxx sample
    To delete bundles, enter a command of the following form:
    fabric:profile-edit --delete --bundle BundleURL Profile [Version]
    To edit bundles directly, using the visual text editor, enter the following command:
    fabric:profile-edit Profile [Version]
    The visual editor opens, showing the contents of the specified profile's agent properties. To edit the bundles, add, modify, or delete lines of the following form:
    bundle.ID=URL
    Where ID is an arbitrary unique identifier and URL specifies the bundle's location.
  • Configuration settings for the OSGi Config Admin service—to modify or create a configuration setting from the OSGi Config Admin service, enter a command in the following format:
    fabric:profile-edit --pid PID/Property=Value Profile [Version]
    Where PID is a persistent ID, which is used in the context of the OSGi Config Admin service to identify a collection of related properties. For example, to change the value of the secure HTTPS port used by the Jetty server in the sample profile, you could edit the org.osgi.service.http.port.secure property from the org.ops4j.pax.web PID using a command like the following:
    fabric:profile-edit --pid org.ops4j.pax.web/org.osgi.service.http.port.secure=8553 sample
    To delete a property, enter a command of the following form:
    fabric:profile-edit --delete --pid PID/Property Profile [Version]
    If the value of the PID property has the form of a comma-separated list, you can use the --append option and the --remove option to manipulate the list value. For example:
    fabric:profile-edit --pid org.example.foo/my.prop=a Profile [Version]
    fabric:profile-edit --append --pid org.example.foo/my.prop=b Profile [Version]
    fabric:profile-edit --append --pid org.example.foo/my.prop=c Profile [Version]
    fabric:display Profile
    ...
    PID: org.example.foo
      my.prop a,b,c
    To edit OSGi Config Admin settings directly, using the visual text editor, enter the following command:
    fabric:profile-edit --pid PID Profile [Version]
    The visual editor opens, showing the contents of the specified profile's PID.properties file (which is actually stored in the ZooKeeper registry). To edit the properties, add, modify, or delete lines of the following form:
    Property=Value
  • Property settings from etc/config.properties—to modify or create a Java system property in the container's etc/config.properties file (which affects the container), enter a command in the following format:
    fabric:profile-edit --config Property=Value Profile [Version]
    For example, to change the value of the karaf.startlevel.bundle Java system property in config.properties, you would enter a command like the following:
    fabric:profile-edit --config karaf.startlevel.bundle=80 Profile [Version]
    To delete a Java system property from config.properties, enter a command of the following form:
    fabric:profile-edit --delete --config Property Profile [Version]
    If the value of the configuration property has the form of a comma-separated list, you can use the --append option and the --remove option to manipulate the list value. For example:
    fabric:profile-edit --config my.prop=a Profile [Version]
    fabric:profile-edit --append --config my.prop=b Profile [Version]
    fabric:profile-edit --append --config my.prop=c Profile [Version]
    fabric:display Profile
    ...
    Config Properties :
              my.prop =     a,
                    b,
                    c
    To edit the Java system properties directly, using the visual text editor, enter the following command:
    fabric:profile-edit Profile [Version]
    The visual editor opens, showing the contents of the specified profile's agent properties. To edit the Java system properties (analogous to etc/config.properties), add, modify, or delete lines of the following form:
    config.Property=Value
  • Property settings from etc/system.properties—to modify or create a Java system property in the container's etc/system.properties file (which affects bundles deployed in the container), enter a command in the following format:
    fabric:profile-edit --system Property=Value Profile [Version]
    For example, to change the default port for the OSGi HTTP service, you would enter a command like the following:
    fabric:profile-edit --system org.osgi.service.http.port=8181 Profile [Version]
    If the system property, Property, is already set at the JVM level (for example, through the --jvm-opts option to the fabric:container-create command), the preceding fabric:profile-edit command will not override the JVM level setting. If you want to override the JVM level setting, you must indicate this explicitly by adding the karaf.override prefix to the property name, Property—for example:
    fabric:profile-edit --system karaf.override.Property=Value Profile [Version]
    To delete a Java system property from system.properties, enter a command of the following form:
    fabric:profile-edit --delete --system Property Profile [Version]
    If the value of the system property has the form of a comma-separated list, you can use the --append option and the --remove option to manipulate the list value. For example:
    fabric:profile-edit --system my.prop=a Profile [Version]
    fabric:profile-edit --append --system my.prop=b Profile [Version]
    fabric:profile-edit --append --system my.prop=c Profile [Version]
    fabric:display Profile
    ...
    System Properties :
              my.prop =     a,
                    b,
                    c
    To edit the Java system properties directly, using the visual text editor, enter the following command:
    fabric:profile-edit Profile [Version]
    The visual editor opens, showing the contents of the specified profile's agent properties. To edit the Java system properties (analogous to etc/system.properties), add, modify, or delete lines of the following form:
    system.Property=Value
    If you want to ensure that this setting overrides any JVM level setting, set the system property as follows:
    system.karaf.override.Property=Value
Important
Any modifications you make to a profile using fabric:profile-edit are immediately propagated to the containers that use that profile. This is not the recommended way to edit profiles, however: if you change multiple settings in the profile, you could potentially put the affected containers into an inconsistent state. To guarantee atomicity, it is better to use the fabric:profile-edit command in combination with the fabric:container-upgrade command—see fabric:container-upgrade.

Enclosing an Option Value in Quotes

The Karaf shell strips double quotes from an option by default. Hence, to enclose an option value in double quotes, it is necessary to enclose the whole setting in double quotes and to escape the quotes around the option value. For example, to define the system property setting, http.nonProxyHosts="myserver1|myserver2", on the default profile, you would use the following command:
fabric:profile-edit --system "karaf.override.http.nonProxyHosts=\"myserver1|myserver2\"" default
Where the karaf.override prefix is prepended to the property name, because http.nonProxyHosts is already set at the JVM level and needs to be overridden.

Arguments

Table 9.42, “fabric:profile-edit Arguments” describes the command's arguments.

Table 9.42. fabric:profile-edit Arguments

ArgumentInterpretation
--help Displays the online help for this command
-p, --pidEdit an OSGi configuration property, specified in the format PID/Property. To specify multiple values, specify this flag multiple times on the command line—for example, --pid PID/Property=Value --pid PID/Property=Value.
-r, --repositoryAdd (or delete) a feature repository. To specify multiple values, specify this flag multiple times on the command line—for example, --repository foo --repository bar.
--repositoriesDeprecated.
-f, --featureAdd (or delete) a feature. To specify multiple values, specify this flag multiple times on the command line—for example, --feature foo --feature bar.
--featuresDeprecated.
-b, --bundleAdd (or delete) a bundle. To specify multiple values, specify this flag multiple times on the command line—for example, --bundle foo --bundle bar.
--bundlesDeprecated.
-c, --configEdit the Java system properties that affect the container (analogous to editing etc/config.properties in a root container). To edit multiple configuration properties, specify this flag multiple times on the command line—for example, --config Property=Value --config Property=Value.
-s, --systemEdit the Java system properties that affect installed bundles (analogous to editing etc/system.properties in a root container). To edit multiple system properties, specify this flag multiple times on the command line—for example, --system Property=Value --system Property=Value.
-o, --overridesAdd (or delete) a bundle override. A bundle override can be used to override the bundle version installed by a feature. For example, if a feature installs version 1.0.0 of a particular bundle, you could use a bundle override to install version 1.0.1 of the bundle instead. To specify multiple values, specify this flag multiple times on the command line—for example, --overrides BundleURL --overrides BundleURL.
-l, --libAdd (or delete) a library. To specify multiple values, specify this flag multiple times on the command line—for example, --lib LibURL --lib LibURL.
--libsDeprecated.
-n, --endorsedAdd (or delete) an endorsed library. To specify multiple values, specify this flag multiple times on the command line—for example, --endorsed LibURL --endorsed LibURL.
-x, --extensionAdd (or delete) an extension library. To specify multiple values, specify this flag multiple times on the command line—for example, --extension LibURL --extension LibURL.
--setSet or create values (selected by default).
--deleteDelete values.
--appendWhen editing list values, append the specified value to the list. Can only be used in combination with the --config, --system, and --pid options.
--removeWhen editing list values, remove the specified value from the list. Can only be used in combination with the --config, --system, and --pid options.
--delimiterSpecifies the delimiter to use in combination with the --append and --remove options. Default is , (comma).
--resourceWhen editing with the visual text editor, specifies the name of the resource to edit.
-i, --import-pidImports the PIDs that are edited, from local OSGi Config Admin.
Profile (Required) Name of the profile to edit.
Version Version of the profile to edit. Defaults to the current default version (use version-list to find the current default).