I want to install an Agent and a USM component in a empty computer whithout installing an application, how can i do this? - cloudify

I have a scenario that I want to use the Agent and USM component to implement the customer command to control a computer, but I donot want to install an application or a service,
how can i reach this goal?
thank you very much!
Steve

You can install an empty service, one that does not actually run anything. This is often called a 'recipe about nothing'. It should look something like this:
service {
name "empty"
type "WEB_SERVER"
lifecycle {
locator {
NO_PROCESS_LOCATORS
}
}
}
Add your custom commands here and you can run them from the Cloudify CLI/REST API as usual.
Note the use of the NO_PROCESS_LOCATORS directive - this tells the USM not to perform any process liveness scans.

Related

No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/NetworkManager/ActiveConnection/

I start my qt application in the user's .profile file (not root) to make the app start on boot. Sometimes when my application start, it reports an warning as below:
"No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/NetworkManager/ActiveConnection/1"
I searched on google but did not find a explanation.
It seems my app is still working fine, but I want to locate the problem.
The application is running on ubuntu and using Qt5.
Thanks in advance.
Edit
I tried to debug dbus based on Eligijus Pupeikis's help with running:
gdbus introspect --system \
--dest org.freedesktop.NetworkManager \
--object-path /org/freedesktop/NetworkManager/ActiveConnection
it returns:
node /org/freedesktop/NetworkManager/ActiveConnection {
node 0 {
};
};
So, this means there is no such object just as the error message said, right?
And also, this gns3 team member says this problem is about Qt and Ubuntu.
Does this mean I don't need to solve it? I not familiar with the relationship between dbus and qt.
Most likely there is no such object "/org/freedesktop/NetworkManager/ActiveConnection/1" and because of that it can't find 'org.freedesktop.DBus.Properties' interface.
From documentation org.freedesktop.NetworkManager.Connection.Active :
Objects that implement the Connection.Active interface represent an attempt to connect to a network using the details provided by a Connection object. The Connection.Active object tracks the life-cycle of the connection attempt and if successful indicates whether the connected network is the "default" or preferred network for access. NetworkManager has the concept of connections, which can be thought of as settings, a profile or a configuration that can be applied on a networking device. Such settings-connections are exposed as D-Bus object and the active-connection expresses this relationship between device and settings-connection. At any time a settings-connection can only be activated on one device and vice versa. However, during activation and deactivation multiple active-connections can reference the same device or settings-connection as they are waiting to be activated or to be deactivated.
You can't know that that ActiveConnection object with specifically index 1 exists so you need to check by reading ActiveConnections property from /org/freedesktop/NetworkManager object's org.freedesktop.NetworkManager interface.
To have better visualize and understand how it looks I suggest D-Bus debugger. If you are using Gnome check out D-Feet.

How to start/stop windows service using Qt?

Lets imagine situation: I have running windows service named "Test". Now I want to stop or start (if it's stopped) this service using Qt app.
How can I do it?
Note:
I don't want to call cmd and use "net start" and "net stop" commands!
You could use the corresponding Qt Solution https://github.com/qtproject/qt-solutions/tree/master/qtservice
Then you can do something like:
QtServiceController controller("Test");
controller.stop();
controller.start();
Unfortunately, Qt does not provide such kind on API.
You need to look into WinAPI solution.
There is an example on MSDN how to stop a service. Im sure you could figure how to use same approach to start it.
Additionally, you could also check a much smaller example how to both start and stop a service.
You can just use the sc command (this page has some usage info or just type sc on the command prompt).
sc stop Test
sc start Test
So:
QProcess::execute("sc", { "stop", "Test" });
QProcess::execute("sc", { "start", "Test" });
Note that you need to be running in an elevated context to control most services.
You could also use net instead of sc if you prefer, same syntax for starting and stopping.
The parameter needs to be the service key name, not the display name; so if you only have the display name you can run sc query or sc GetKeyName "Display Name" and parse the output.

Rocket chat: Determine if the app is running in Desktop or browser

Is there anyway to determine if the Rocket.chat app is running in desktop or browser?
Thank you in advance. :)
You can look at server environment variables using a line like this:
console.log(process.env.TZ);
If you need to access that from the client, you can do this in your client code:
console.log("TZ = "+Meteor.call("getEnv","TZ"));
and in your meteor methods (in the server folder)
Meteor.methods({
getEnv: function(varname) {
return process.env[varname];
},
Obviously use this with care. It is a generic method that may present a security hole. If you want to make it more secure, just write a specific method where you don't pass the environment variable name, to prevent any kind of malicious attack.

Return to specific Watson Virtual Agent flow after a custom workspace

I'm working with Watson Virtual Agent (WVA) and a custom conversation workspace (WCS) and was hoping that there was a way that I could go from a custom conversation flow back into a WVA flow.
My specific use case would be when I want to escalate to agent from within WCS. There are already preconfigured flows for this inside WVA which I think calling on would be the easiest way to complete the escalate to agent process.
I know that to force WCS to return to the WVA I need to somehow add
system.dialog_stack[0] == root
to the context, however, the instructions here don't go further than saying add to context. So far I just get errors when I add it to context with and without "" marks. Whilst I don't think that this would solve my issue I have actually been unable to test this.
I would welcome any answers specific to my example, specific to how to actually implement system.dialog_stack[0] == root in WCS or to the general question which I expect will have more uses for other users.
Having done some more research I have discovered that it is possible to call on the specific Escalate to Agent flow type using an action.
The use of actions is explained in the documentation I linked to above although there is no list of preconfigured actions.
Here is an example of a node in WCS that would allow one to connect to agent using the connection that you've set up in WVA:
{
"output": {
"text": "I will connect you with an agent now.",
"action": {
"name": "agent"
}
}
}
Until there is a list of the actions available for use in WVA/WCS I don't know if this is a fix that would work with other flows. I found this using Postman extension in Chrome and using my WVA keys and replicated the action that was called during the Escalate to Agent flows in WVA.

Test to identify your development environment?

The code has a runtime dependency which is not available in our development environment (and is available in test and prod). It's expensive to actually test for the dependency, and I want to test for the environment instead.
if (isDevEnvironment) {
// fake it
}
else {
// actually do it
}
Without using appSettings, what code/technique/test would you use to set isDevEnvironment?
Example answers:
check machine name (partial or full)
check for running instance of Visual Studio
check for environment variable
I'm hoping for a test I hadn't considered.
You should try to not test your environment in the code! That's why dependency inversion (and then injection) has been invented for.
Draw some inspiration from NewSpeak, where where the complete platform is abstracted in an object and passed as parameter down the chain of method calls.
The code you provided (if (isDevEnvironment) ..) smells with test code in production.
Without using appSettings, what code/technique/test would you use to set isDevEnvironment?
Generally, Dependency Injection.
But also the the possible Solution in the link provided.
You should not check the environment, instead you need to provide the environment.
You've hit upon the major techniques. At my current job, we use the Enviroment variable technique.
At a previous job, all servers had three NIC's, there was the public front end, the middle tier for server to server traffic, and the back end Network Operations would connect to.
There were on different IP subnets. It made it easy to detect where something was coming from, but also who where was it.
Example:
10.100.x.xxx - Production Subnet
10.100.1.xxx - Back
10.100.2.xxx - Middle
10.100.3.xxx - Front
10.0.1.x - Development Subnet
This required nothing to be installed special on the servers, just code detection and then caching.
I prefer to do this:
if(Properties.Settings.Default.TestEnvironment || HttpContext.Current.Request.ServerVariables["Server_Name"] == "localhost")
{
// do something
}

Resources