To create a new config group, it is mandatory to provide a config group name, a tag and the cluster name to which it belongs. The tag as seen in this example is a name of the service. Two config groups with the same tag cannot be associated with the same host.
how to run the following json file with curl ?
in order to set this config group in ambari
POST /api/v1/clusters/c1/config_groups
[
{
"ConfigGroup": {
"cluster_name": "c1",
"group_name": "hdfs-nextgenslaves",
"tag": "HDFS",
"description": "HDFS configs for rack added on May 19, 2010",
"hosts": [
{
"host_name": "host1"
}
],
"desired_configs": [
{
"type": "core-site",
"tag": "nextgen1",
"properties": {
"key": "value"
}
}
]
}
}
]
reference - https://github.com/swagle/test/blob/master/docs/api/v1/config-groups.md
Is your question about how to send multiline json with curl? You can find different methods here.
Related
I have posted a bulk import with a file containing group transaction bundles in ndjson format. After posting I see them to be stored as bundles itself in the FHIR store instead of individual resources. But according to documentation when we store data as transaction bundle the resources inside that bundle should be created individually, but the records are getting created as a bundle itself.
I am using following import body, let me know if any changes are to be done for the body
How to post transaction bundle using $import?
{
"resourceType": "Parameters",
"parameter": [
{
"name": "inputFormat",
"valueString": "application/fhir+ndjson"
},
{
"name": "mode",
"valueString": "InitialLoad"
},
{
"name": "input",
"part": [
{
"name": "type",
"valueString": "Bundle"
},
{
"name": "url",
"valueUri": "https:xyz/fhir-sample-import-data/patient_bundles_ndjson.ndjson"
}
]
}
]
}
I have an existing configMap with JSON data. The data could be anything that is allowed in JSON format - arrays, objects, strings, integers, etc.
For example:
{
"channels": ["10", "20", "30"],
"settings": "off",
"expiry": 100,
"metadata": {
"name": "test",
"action": "update"
}
}
Now I want to update the configMap with newer data.
The catch is that I don't want to update any of the values, but just to add or remove any fields that have been added or removed in the new data.
The reason for this is that the values are defaults and might have been already updated in the configMap by other pods/services.
So for example, if the new data contains the below JSON data (expiry field removed and some values changed):
{
"channels": ["10", "20", "30", "100", "10000"],
"settings": "on",
"metadata": {
"name": "test",
"action": "delete"
}
}
Then I expect the configMap to be updated to look like this:
{
"channels": ["10", "20", "30"],
"settings": "off",
"metadata": {
"name": "test",
"action": "update"
}
}
so the values stayed as they were, but the 'expiry' field was removed.
I am using ansible to deploy the kubernetes resources, but I am open to other tools/scripts that could help me achieve what I need.
Thanks in advance
This is not supported by Kubernetes. As you said, the data is JSON-encoded, it's a string. ConfigMap (and Secrets) only understand strings, not nested data of any kind. That's why you have to encode it before storage. You'll need to fetch the data, decode it, make your changes, and then encode and update/patch in the API.
I'm trying to find if JSON file supports defining variables and using them within that JSON file?
{
"artifactory_repo": "toplevel_virtual_NonSnapshot",
"definedVariable1": "INSTANCE1",
"passedVariable2": "${passedFromOutside}",
"products": [
{ "name": "product_${definedVariable1}_common",
"version": "1.1.0"
},
{ "name": "product_{{passedVariable2}}_common",
"version": 1.5.1
}
]
}
I know YAML files allow this but now sure if JSON file allows this behavior or not. My plan is that a user will pass "definedVariable" value from Jenkins and I'll create a target JSON file (after substi
This might help you:
{
"artifactory_repo": "toplevel_virtual_NonSnapshot",
"definedVariable1": "INSTANCE1",
"passedVariable2": `${passedFromOutside}`,
"products": [
{ "name": `product_${definedVariable1}_common`,
"version": "1.1.0"
},
{ "name": `product_${passedVariable2}_common`,
"version": 1.5.1
}
]
}
*Note the use of `` instead of ''
In the Consul ACL Internals documentation, sample configuration is provided to set some default ACL rules in both HashiCorp Configuration Language and JSON. It looks like this:
{
"key": {
"": {
"policy": "read"
},
"foo/": {
"policy": "write"
},
"foo/private": {
"policy": "deny"
}
},
"service": {
"": {
"policy": "write"
},
"secure-": {
"policy": "read"
}
},
"event": {
"": {
"policy": "write"
},
"destroy-": {
"policy": "deny"
}
},
"query": {
"": {
"policy": "read"
}
},
"keyring": "read",
"operator": "read"
}
The documentation only explains how to set up the default role.
Using the HTTP API, you can create role tokens with rules by passing JSON similar to this to the create endpoint:
{
"Name": "my-app-token",
"Type": "client",
"Rules": ""
}
But I want to be able to set this up in my static configuration files to have multiple roles with their associated policies.
How can I do this? Do I just add Name, Type, Roles and a UUID? If so, where/how do I do so?
I have figured out through the Consul Google Groups page that, according to a user, ACLs cannot currently be defined as static config files and must be configured via the HTTP API:
Currently the ACLs cannot be directly inserted into
a configuration file that Consul will read. The API is the primary way of interaction with ACLs.
(As of 10 October 2015)
https://groups.google.com/d/msg/consul-tool/fGuFTq0fvcU/f6-mwh4aCQAJ
I have a small problem. Im doing a subscription to Orion Context Broker and I have a strange problem with URL of callback:
this code works from tutorial:
{
"entities": [
{
"type": "Room",
"isPattern": "false",
"id": "Room1"
}
],
"attributes": [
"temperature"
],
"reference": "http://localhost:1028/accumulate",
"duration": "P1M",
"notifyConditions": [
{
"type": "ONTIMEINTERVAL",
"condValues": [
"PT10S"
]
}
]
}
But this code doesnt work:
{
"entities": [
{
"type": "Room",
"isPattern": "false",
"id": "Room1"
}
],
"attributes": [
"temperature"
],
"reference": "http://192.168.1.12:1028/accumulate?name=dupex",
"duration": "P1M",
"notifyConditions": [
{
"type": "ONTIMEINTERVAL",
"condValues": [
"PT10S"
]
}
]
}
Only difference is reference field:
"reference": "192.168.1.12:1028/accumulate?name=dupex"
I got:
{
"subscribeError": {
"errorCode": {
"code": "400",
"reasonPhrase": "Bad Request",
"details": "Illegal value for JSON field"
}
}
}
Any Suggestion please :) thank you.
The root cause of the problem is that = is a forbidden character, not allowed in payload request for security reasons (see this section in the user manual about it).
There are two possible workarounds:
Avoid the usage of query strings in the URL for reference in subscribeContext, e.g. using http://192.168.1.12:1028/accumulate/name/dupex.
Encode URL encoding to avoid forbidden characters (in particular, the code for = is %3D) and prepare your code to decode it.
In case 2, you could use the follwoing reference in subscribeContext: http://192.168.1.12:1028/accumulate?name%3Ddupex. Then, an example of code that will take into account the encoding and get the name argument properly would be the following (written in Python using Flask as REST server framework):
from flask import Flask, request
from urllib import unquote
from urlparse import urlparse, parse_qs
app = Flask(__name__)
#app.route("/accumulate")
def test():
s = unquote(request.full_path) # /accumulate?name%3Dduplex -> /accumulate?name=duplex
p = urlparse(s) # extract the query part: '?name=duplex'
d = parse_qs(p.query) # stores the query part in a Python dictionary for easy access
name= d['name'][0] # name <- 'duplex'
# Do whatever you need with the name...
return ""
if __name__ == "__main__":
app.run()
I guess that a similar approach can be used in other languages (Java, Node, etc.).
EDIT: Orion version 1.2 support notification customization in the NGSIv2, which allows this use case. For example, you can define the following subscriptions:
{
..
"notification": {
"httpCustom": {
"url": "http://192.168.1.12:1028/accumulate",
"qs": {
"name": "dupex"
}
}
..
}
..
}
Please have a look to "Subscriptions" and "Custom Notifications" sections at NGSIv2 Specification for details.