I just downloaded and ran the sample from here. It is working but whenever I connect to the web site (https://something.ngrok.io/) or even refreshing it takes a lot of time andd the Node.js console shows it is getting a lot of "/bower_components", also even thought I have log in with the same account ("rick/oldman"), previously-added devices are gone.
I want to add a persistent simple virtual light, so I saw datastore.js, and either the documentation is missing or I could not find it. The only thing I could find was the comment.
/**
* Structure of Data
* {
* <uid>: {
* <device id>: {
* properties: {
* <property name>: <property value>,
* <property name>: <property value>
* },
* states: {
* <state name>: <state value>,
* <state name>: <state value>
* }
* },
* <device id>: {...}
* },
* <uid>: {
* <device id>: {...},
* <device id>: {...},
* <device id>: {...}
* },
* ...
* }
*/
There was no sample, so I inferred from the logs (created a device on the web site), and created one like this, but this device does not show up.
const config = require('./config-provider');
const Data = {
"f9b2dc04-2518-11e8-b467-0ed5f89f718b":{
"light1":{
"states":{
"on": false,
"online":true
},
"properties":{
"type":"action.devices.types.LIGHT",
"traits":["action.devices.traits.OnOff"],
"attributes":{
"temperatureMinK":2000,
"temperatureMaxK":6500
},
"name":{
"defaultNames":[
"Fake Light"
],
"name":"Fake Light 1",
"nicknames":[
"fake lamp"
]
},
"willReportState":false,
"roomHint":"",
"deviceInfo":{
"manufacturer":"Fake Home Provider",
"model":"fake1234",
"swVersion":"1.0.0",
"hwVersion":"1.0"
},
"customData":{
"smartHomeProviderId":"thisisfakesuperfake"
}
}
}
}
};
I am not sure if the data is correct or not; I could not find any sample for that. What do I need to do to have a persistent virtual device and prevent re-downloading the bower components?
This behavior was introduced to make it easier for testing different configurations. The behavior happens here in the sample code:
app.post('/smart-home-api/reset-devices', function (request, response)
This behavior may be a bit weird depending on how people use the sample, so I have added a new configuration option: Config.enableReset.
By default, it will be true. However, by setting that to false it should persist the devices across page refreshes.
As for Bower, it should not be downloading the files every time, I think those logs are just noting that the files are being "Gotten" from the server. I believe the server caches the responses, so you may be seeing status codes in the 300 range instead of 200.
Related
I'm trying to connect IBM Cloud Functions with a Watson Assistant dialog as web_action. So I have specified web_action as following in watson dialog json editor.
"actions": [
{
"name": "rajesh#heltha.co_dev/default/callKinvey",
"type": "web_action",
"parameters": {
},
"credentials": "$private.mycredential",
"result_variable": "context.my_input_returned"
}
]
Now, the issue is while testing assistant I'm getting following error
Internal error: Content-type can not be retrieved. (and there is 1 more error in the log)
Following is my function that is created on IBM-cloud and enabled for Web Action:
/**
*
* main() will be run when you invoke this action
*
* #param Cloud Functions actions accept a single parameter, which must be a JSON object.
*
* #return The output of this action, which must be a JSON object.
*
*/
function main(params) {
return { message: 'Hello World' };
}
CURL of my function is:
curl -u API-KEY -X POST https://us-south.functions.cloud.ibm.com/api/v1/namespaces/rajesh#heltha.co_dev/actions/callKinvey?blocking=true
The easiest way to solve this type of error is to append .json to your endpoint.
I am using the VMWare vCenter REST API to deploy new Virtual Machines from OVF library items. Part of the API allows for additional_paramaters but I am unable to get it to function properly. Specifically, I would like to set the PropertyParams for custom OVF template properties.
When deploying VM from OVF, I am using the following REST API:
POST https://{server}/rest/com/vmware/vcenter/ovf/library-item/id:{ovf_library_item_id}?~action=deploy
I have tried many structures and either end up with the POST succeeding but the parameters completely ignored, or with a 500 Internal Server error with a message about failing to convert the properties structure:
Could not convert field 'properties' of structure 'com.vmware.vcenter.ovf.property_params'
The payload that seems correct from the documentation (but fails with the error above):
deployment_spec : {
/* ... */
additional_parameters : [
{
type : 'PropertyParams',
properties : [
{
id : 'my_property_name',
value : 'foo',
}
]
}
]
}
Given an OVF that contains the following:
<ProductSection>
<Info>Information about the installed software</Info>
<Product>MyProduct</Product>
<Vendor>MyCompany</Vendor>
<Version>1.0</Version>
<Category>Config</Category>
<Property ovf:userConfigurable="true" ovf:type="string" ovf:key="my_property_name" ovf:value="">
<Label>My Property</Label>
<Description>A custom property</Description>
</Property>
</ProductSection>
This also fails for other property types such as boolean.
Note that I have posted on the vCenter forums as well.
I had the same issue, i success to solve it by browsing the vapi structure /com/vmware/vapi/metadata/metamodel/structure/id:<idstructure>
Here is my finding :
firstly, get your properties structure by using the filter api :
https://{{vc}}/rest/com/vmware/vcenter/ovf/library-item/id:300401a5-4561-4c3d-ac67-67bc7a1a6
Then, to deploy, use the class com.vmware.vcenter.ovh.property_params. It will be more clear with the exemple :
{
"deployment_spec": {
"accept_all_EULA": true,
"name": "clientok",
"default_datastore_id": "datastore-10",
"additional_parameters": [
{
"#class": "com.vmware.vcenter.ovf.property_params",
"properties":
[
{
"instance_id": "",
"class_id": "",
"description": "The gateway IP for this virtual appliance.",
"id": "gateway",
"label": "Default Gateway Address",
"category": "LAN",
"type": "ip",
"value": "10.1.2.1",
"ui_optional": true
}
],
"type": "PropertyParams"
}
]
}
We are trying to use Drool as our rule engine service. What we done till now is listed below
Deployed workbench 7.2.Final
Deployed KIE server 7.2.0.Final
Configured some data objects, rules, deployed the changes to KIE server and we are able to execute the rule using rest API
Most of our requirements satisfied by stateless session (Give a set of data, execute the rule and return the data, that's it) . But using stateless we have to compromise many of the important features provided by Drools stateful session.
So we are trying to use stateful session per request. Which means the session should get disposed as soon as the request end. Also, parallel request should not interfere each other even if the session name is same
We found about container runtime strategy configuration (Workbench > Deploy > {any container} > Process Configuration > Runtime strategy)
But even after configure the container strategy to Per Request, it still behave same as Singleton (the session is not getting disposed after each request)
Few place we read it as, run time strategy only implemented in jBPM
The way we make request to KIE server is shown below
Request: POST {HOST}/kie-server/services/rest/server/containers/instances/TestRequest_1.0.4
{
"lookup": "ab-session", //stateful session
"commands": [
{
"insert": {
"out-identifier": "125",
"object": {
"com.myteam.testrequest.Product": {
"id": "123",
"name": "Hoo Hoo",
"count": 0
}
},
"return-object": "true"
}
},
{
"insert": {
"out-identifier": "126",
"object": {
"com.myteam.testrequest.Product": {
"id": "123",
"name": "Hoo Hoo",
"count": 0
}
},
"return-object": "true"
}
},
{"fire-all-rules": "hf2"}
]
}
We need help in achieving this requirement. Also, please help understand if we done something wrong
In kmodule.xml you may try to add "prototype" scope, because default is "singleton":
<ksession name="SessionName" type="stateful" default="false" clockType="realtime" scope="prototype"/>
we use to follow instruction here! to set the bucket lifecycle policy, but with the latest gcloud components update, we are getting an error like this:
Failure: Unsupported tag SetStorageClass.
search the gcs storage lifecycle doc did not fund any update.
The command we used is gsutil lifecycle set <json file> gs://<bucket name>/
and gsutil version: 4.25
{
"lifecycle":{
"rule":[
{
"action":{
"type":"SetStorageClass",
"storageClass":"NEARLINE"
},
"condition":{
"age":30,
"matchesStorageClass":[
"REGIONAL",
"STANDARD",
"DURABLE_REDUCED_AVAILABILITY"
]
}
}
]
}
}
EDIT 2
This was fixed in this GitHub commit, which has been included in the newest version (v4.26) of gsutil.
EDIT
It looks like you actually uncovered a bug that occurs when using the XML API. I've opened a GitHub issue an will work on fixing this ASAP:
https://github.com/GoogleCloudPlatform/gsutil/issues/427
Thanks for the report!
Looking at the code in the Boto library, you're probably trying to specify SetStorageClass a JSON key:
{
...
"SetStorageClass": ...
...
}
rather than making it the value of the action's type attribute. Here's an example using your (fixed) sample from a question comment:
{
"lifecycle": {
"rule": [
{
"action": {
"type": "SetStorageClass",
"storageClass": "NEARLINE"
},
"condition": {
"age":30,
"matchesStorageClass": ["STANDARD", "DURABLE_REDUCED_AVAILABILITY"]
}
}
]
}
}
This might be a very newbie question, but I can't seem to get my Sails.js app working in production mode. I start it in production mode by setting NODE_ENV=production and it says it has lifted successfully on localhost:1337 but when I try to go to the link it just time out with no reply from server.
The Sails.js app works fine in development mode.
Been through all the documentation and can't see what am missing.
I have a production.js config file.
-- production.js (endpoints anonymized) ---
/**
* Production environment settings
*
* This file can include shared settings for a production environment,
* such as API keys or remote database passwords. If you're using
* a version control solution for your Sails app, this file will
* be committed to your repository unless you add it to your .gitignore
* file. If your repository will be publicly viewable, don't add
* any private information to this file!
*
*/
module.exports = {
minicabit: {
api: {
host: "https://api-endpoint",
prepend: "/vX/",
key: "wrwerwrwrwewre"
}
},
log: {
level: 'info'
},
csrf: true,
/***************************************************************************
* Set the default database connection for models in the production *
* environment (see config/connections.js and config/models.js ) *
***************************************************************************/
models: {
connection: 'connMysql'
},
// models: {
// connection: 'someMysqlServer'
// },
/***************************************************************************
* Set the port in the production environment to 80 *
***************************************************************************/
//port: 80,
/***************************************************************************
* Set the log level in production environment to "silent" *
***************************************************************************/
// log: {
// level: "silent"
// }
blueprints: {
rest: false,
shortcuts: false
},
session: {
/***************************************************************************
* *
* In production, uncomment the following lines to set up a shared redis *
* session store that can be shared across multiple Sails.js servers *
***************************************************************************/
adapter: 'connect-redis',
/***************************************************************************
* *
* The following values are optional, if no options are set a redis *
* instance running on localhost is expected. Read more about options at: *
* https://github.com/visionmedia/connect-redis *
* *
* *
***************************************************************************/
host: 'redis-endpoint',
port: 6379,
ttl: 3600
// db: 0,
// pass: <redis auth password>,
// prefix: 'sess:'
}
};
Am I missing anything else?
Thanks
I have found the issue, it looks like the connect-redis module I installed is not compatible with sail.js
https://github.com/balderdashy/sails/issues/2379