Chef API: Adding runlists to a node - rest

I am trying to figure out how to use the Chef API to add a runlist to a node, such that, when I go to the https://mychefserver/nodes/myapp01 node, I see the runlist under the Run List section.
But the Chef API doesn't appear to allow this. Am I wrong, if so, what's the endpoint and how do I call it?

Run lists aren't their own object, it is just part of the data in the Node object so you would use the normal GET /nodes/foo and PUT /nodes/foo. The run list is under the key run_list and should be an array of strings.

Related

How can I find an existing node and then link it to another node?

Would something like this work?
Basically what I am trying to do is to link an edge to a node but in return linking the node to an existing node but I need to query the node to find it to link it.
here -[people_link(id="123")]-> node::person(name==w);
This should work in version 1.4 of Jaseci. Try somethign like
here +[people_link(id="123")]+> node::person(name==w);

Pulumi DigitalOcean: different name for droplet

I'm creating a droplet in DigitalOcean with Pulumi. I have the following code:
name = "server"
droplet = digitalocean.Droplet(
name,
image=_image,
region=_region,
size=_size,
)
The server gets created successfully on DigitalOcean but the name in the DigitalOcean console is something like server-0bbc405 (upon each execution, it's a different name).
Why isn't it just the name I provided? How can I achieve that?
This is a result of auto-naming, which is explained here in the Pulumi docs:
https://www.pulumi.com/docs/intro/concepts/resources/names/#autonaming
The extra characters tacked onto the end of the resource name allow you to use the same "logical" name (your "server") with multiple stacks without risk of a collision (as cloud providers often require resources of the same kind to ba named uniquely). Auto-naming looks a bit strange at first, but it's incredibly useful in practice, and once you start working with multiple stacks, you'll almost surely appreciate it.
That said, you can generally override this name by providing a name in your list of resource arguments:
...
name = "server"
droplet = digitalocean.Droplet(
name,
name="my-name-override", # <-- Override auto-naming
image="ubuntu-18-04-x64",
region="nyc2",
size="s-1vcpu-1gb")
.. which would yield the following result:
+ pulumi:pulumi:Stack: (create)
...
+ digitalocean:index/droplet:Droplet: (create)
...
name : "my-name-override" # <-- As opposed to "server-0bbc405"
...
.. but again, it's usually best to go with auto-naming for the reasons specified in the docs. Quoting here:
It ensures that two stacks for the same project can be deployed without their resources colliding. The suffix helps you to create multiple instances of your project more easily, whether because you want, for example, many development or testing stacks, or to scale to new regions.
It allows Pulumi to do zero-downtime resource updates. Due to the way some cloud providers work, certain updates require replacing resources rather than updating them in place. By default, Pulumi creates replacements first, then updates the existing references to them, and finally deletes the old resources.
Hope it helps!

VSTS: Built in variable for organization name?

In many of the calls described in the Azure DevOps REST API documentation, I need to supply the name of the organization, e.g.:
https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/releases?api-version=5.0-preview.8
The project I can get from System.TeamProject. I would have expected something similar for organization name, something like:
System.TeamFoundationCollectionName
This does not seem to be available. I've even printed out all of my environment variables on the agent and don't see anything that fits the need exactly. Sure, I can parse it out of one of the other values, but this seems fragile since MS seems to like to change the format of URLs.
I also can't hard code the organization name because this release definition will live in multiple organizations and we don't want to have to manually update it for each. How are others solving this problem?
Try using System.TeamFoundationServerUri and System.TeamFoundationCollectionUri to build your API requests. They have the organization included in them.
https://learn.microsoft.com/en-us/azure/devops/pipelines/release/variables?view=vsts&tabs=batch
edit: SYSTEM_TEAMFOUNDATIONSERVERURI/BUILD_PROJECTNAME/_apis/release/releases?api-version=5.0-preview.8
It looks like currently there is no such variable for the organization, also, the variables return the old URL (xxx.visualstudio.com) and not the new URL (dev.azure.com/xxx) so if you use the System.TeamFoundationCollectionName the API should work without the {organization}:
https://System.TeamFoundationCollectionName/{project}/_apis/release/releases?api-version=5.0-preview.8.
In Powershell, do this:
# Where SYSTEM_TEAMFOUNDATIONCOLLECTIONURI=https://some_org_name.visualstudio.com/
([System.Uri]$Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI).Host.split('.')[-3] # returns 'some_org_name'
Now, just assign that to a variable and use it anywhere you like. "SYSTEM_TEAMPROJECT" is the Project Name, so no need to do any parsing there. It is already available.

How to list Zabbix macro values for a host

I've a Zabbix item which I can't get to work using a Zabbix macro.
The item key I start with looks like this:
web.page.regexp[10.0.0.100,/path,"(.*)",, \1]
And testing it with the following command also shows me nice results:
$ sudo zabbix_agentd -t 'web.page.regexp[10.0.0.100,/path,80,"(.*)",, \1]' --print
web.page.regexp[10.0.0.100,/path,80,"(.*)",, \1] [s|works]
But of course using the IP hardcoded isn't nice, that's why I want to use the predefined macros within the key, like this:
web.page.regexp[{HOST.IP1},/path,"(.*)",, \1]
But unfortunately this macro doesn't resolve to anything and the result looks like this:
web.page.regexp[10.0.0.100,/path,80,"(.*)",, \1] [s|]
Therefore I'd love to know if there's any way to list all the macro values for a specific host in Zabbix. Or is there a better way to use the {HOST.*} macros?
Using localhostis not an option for me - I want to test the public interface and I want to understand why the macros don't work as I expect it.
Cheers
Macro {HOST.IP1} should be expanded correctly for passive agent items (although it is suggested to just use {HOST.IP}). However, if your item is an active agent item, then {HOST.IP1} will expand to *UNKNOWN*, because an item is not attached to an interface in that case.
As for macro list for a host, it was implemented for user macros under ZBXNEXT-210 and is already available in pre-2.5.0 trunk (which is not ready for production yet).

neo4j spatial findGeometriesWithinDistance REST

Using neo4j 1.9 and neo4j spatial for 1.9.
Trying to get findGeometriesWithinDistance REST call working.
I can confirm that the install has worked and that the function exists BUT, using the http console I get a "Node 0 does not exist" error. The REST request I make is exactly as in the docs but instead of returning nodes I get this error.
What is going on that requires node 0 to exist and hence causes the error?
For info, the REST findGeometriesInBBox works fine.
On Further Investigation...
Using py2neo to interact with the DB. In particular, we make use of the GregorianCalendar functionality (see here). When removed from our logic the process of findGeometriesWithinDistance works fine.
Looking into it further, there are comments in the py2neo code that say #retain a handle to the root node (see the first code example here).
Does this "handle" do something with the node of index 0 so we can't use it?
Did you accidentally clean out your database?
I.e. remove node 0, which was the reference node that neo4j-spatial connected its root elements to (in 1.9)?