vSphere Build Version via API - rest

Is there a way do get the vsphere build versing using any API/SDK/REST?
I know it's possible using powershell on vcenter for that, but it'd be great if there was another option.
Like described here: https://www.virtuallyghetto.com/2017/08/powercli-script-to-help-correlate-vcenter-esxi-vsan-buildversions-wo-manual-vmware-kb-lookup.html

It looks like you should be able to using the VMware vSphere API Python Bindings, as you can just simulate going through the Managed Object Browser.
Parent Managed Object ID: ServiceInstance
Property Path: content.about
And then there is a build string which is what you are looking for.

I figure out how to do this, my need is having as much information about vsphere as possible, so get datacenter, cluster and host details is mantaroy.
For that I used the official ruby api, rbvmomi, but I believe it's exactly the same thing for python one and golang.
It's needed to interact through host folder under root/children object, which is not that clear on wmware api docs, to get it easier follow a piece of code:
vim = RbVmomi::VIM.connect host: host, user: 'user', password: 'pass', insecure: true, debug: false
vim.root.children.each do |root_child|
root_child.hostFolder.children.each do |child|
child.host.each do |host|
prod = host.config.product
puts host.name,
prod.apiType,
prod.apiVersion,
prod.build,
prod.fullName,
prod.instanceUuid,
prod.licenseProductName,
prod.localeBuild,
prod.localeVersion,
prod.name,
prod.osType,
prod.productLineId,
prod.vendor,
prod.version
end
end
end

Related

How to get version using EWS powershell

$Service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2013_SP1);
In the above line Exchange2013_SP1 is hardcoded. Using powershell how can I dynamically get the version when running the script?
In the Code provided, you are trying to create an instance of WebServices.Data.ExchangeService(something similar to this), specifying exchange version via ExchangeVersion Enum.
However - the query after that is about knowing how to obtain Exchange Version via PowerShell. Probably this is very well documented and googling shows many hits about checking Exchange Version:
https://blogs.msdn.microsoft.com/deva/2012/04/27/powershell-determine-version-number-build-number-and-service-pack-of-exchange-server/
https://blog.jasonsherry.net/2012/12/27/get-exchangever/
If you make a request like Binding to the Inbox of a Mailbox in the response the build details of the CAS Server the processed the response is returned https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.exchangeservicebase.serverinfo(v=exchg.80).aspx and exposed via the ExchangeService Class this can be used to tell the CU that's been applied to the Target and is the most useful thing if you trying to track errors etc.
EWS Schema version (which is what you have hardcoded) and Server versions are two different things so I would suggest you read https://msdn.microsoft.com/en-us/library/office/dn741586(v=exchg.150).aspx . Autodiscover can be used to find the highest EWS Schema version of CAS server.

How to run Identity Server V3 client examples

I'm trying to run some of the examples from here. They're configured to access localhost:44333 - if I run one of the examples, e.g. JavascriptResourceOwner, the calls to that address are not getting any response. What project/solution should I be running on that port?
You should run IdentityServer in separate solution for example from example
IdentityServer3.AspNetIdentity
All client samples are designed to be run with the core project host:
https://github.com/IdentityServer/IdentityServer3

Setting :deploy_to from server config in Capistrano3

In my Capistrano 3 deployment, I would like to set the set :deploy_to, -> { "/srv/www/#{fetch(:application)}" } so the :deploy_to is different for each server it deploys to.
In my staging.rb file I have:
server 'dev.myserver.com', user: 'deploy', roles: %w{web app db}, install_path: 'mycustom/path'
server 'dev.myserver2.com', user: 'deploy', roles: %w{web app db}, install_path: 'mycustom/other/path'
My question is: would it possible to use the "install_path" I defined, in my :deploy_to? If that's possible, how would you do it?
Finally, after looking around, I came onto an issue from one of the developer of Capistrano, stating specifically that it can't be done
Quote from the Github issue:
Not possible, sorry. fetch() (as is documented widely) reads values
set by set(), the only reason to use set() and fetch() over regular
ruby variables is to provide a consistent API between plugins and
extensions, and because set() can take a Proc to be resolved later.
The variables you are setting in the host object via the server()
command belong to an individual host, some of them, user, roles, etc
have special meanings. For more information see
https://github.com/capistrano/sshkit/blob/master/EXAMPLES.md#do-something-different-on-one-host-or-another-depending-on-a-host-property.
If you specifically need to deploy to a different directory on each
machine you probably should not be using the built-in tasks (they
don't fit your needs), and rather copy the deploy.rake from the Gem
into your own project, and modify it as you need. Which in this case
might be to not take fetch(:deploy_to), but to read that from a host
property.
You could try to do something where before doing anything that relies
on calling fetch(:deploy_to), you set() it using the value from
host.someproperty but I'm pretty sure that'll break in exciting and
interesting ways.

Configuring spring-xd to use oracle as job repository

I want to run spring xd with Oracle(11g) which i already have in my environment. Currently my first concern is the jobs UI (my database has existing data of job executions that were performed by spring-batch and i simply want to display the details of those executions).
i'm using spring-xd-1.0.0.M5. I followed the instructions in the reference guide and i changed application.yml to have the following:
spring:
datasource:
url: jdbc:oracle:oci:MY_USERNAME/MYPWD#//orarmydomain.com:1521/myservice
username: MY_USERNAME
password: MYPWD
driverClassName: oracle.jdbc.OracleDriver
profiles:
active: default,oracle
i modified also batch-jdbc.properties to have the database configuration similar to the above.
Yet, when i start xd-singlnode.bat (or either xd-admin.bat) it seems like it ignores my oracle configuration and still uses the default hsqldb.
what am i doing wrong?
Thanks
The likely reason is that we did not upgrade the windows .bat scripts to take advantage of the property overriding via xd-config.yml. If you go into the unix script for xd-singlenode you will see that when java is invoked there there is an option
-Dspring.config.location=$XD_CONFIG
you can for now hardcode your location of that file, use file: as the prefix.
Also, The UI right now is very primitive, you will not be able to see many details about the job execution. There are however many job related commands you can execute in the shell and there is only one gap regarding step execution information as compared to what is available via spring-batch-admin.
The issue to watch for this is https://jira.springsource.org/browse/XD-1209 and it is schedule for the next milestone release.
Let me know how it goes, thanks!
Cheers,
Mark

Can I call synchroniseUserDirectories (ConfluenceRpc) via REST, SOAP or XML-RPC?

I am using Confluence 4.2.5 (build 3284) with CAS SSO connected to my LDAP server and would like to be able to call synchroniseUserDirectories() from the LDAP server when a user changes their password so that the change is instantaneous.
The way it works now is that users have to wait for the Confluence to run it's periodic LDAP synchronization which can be disconcerting for them.
I have tried using the XML-RPC interface to call changeUserPassword() (as an administrator) but it doesn't work. The operation raises an exception "Error changing password for user ...". I presume that that is because the user is defined in the LDAP but I can't tell for sure because the exception message wasn't clear about the cause.
Here is example code that I would like to be able to use. It doesn't work.
#!/usr/bin/env python
import xmlrpclib
url = 'https://docs.example.com'
admin_user = 'frobisher'
admin_pass = 'supersecretstuff'
username = 'bigbob'
new_password = 'bigbobsbigsecret'
server = xmlrpclib.ServerProxy(url + '/rpc/xmlrpc')
token = server.confluence2.login(admin_user, admin_pass)
# CITATION: https://developer.atlassian.com/display/CONFDEV/Remote+Confluence+Methods
# this doesn't exist but would be my preferred approach.
# It raises a NoSuchMethodException exception.
server.confluence2.synchroniseUserDirectories(token)
# this throws a general exception, because of the LDAP? The message
# wasn't clear about the source of the problem.
#server.confluence2.changeUserPassword(token,
# username,
# password)
server.confluence2.logout(token)
Is there any way to do this using SOAP or REST? I was concerned about REST because it sounds like it is still a prototype.
If none of those approaches will work, can it be done with a simple plugin considering that this must be a push operation from the LDAP server to the Confluence server? I have no experience writing plugins but I do some java work occasionally.
Any hints would be greatly appreciated.
The short answer is "no". The ability to synchronise remote user directories is not exposed as a remote operation in Confluence.
The long answer is "yes", you can write a plugin to do this. If you're already familiar with java, then perhaps the best answer is to just show you some source code I've written that performs a similar function: https://bitbucket.org/jaysee00/confluence-user-sync-api This plugin gives you SOAP, XML-RPC and JSON-RPC methods to force an individual user account to be synced in to Confluence from a remote directory.
That might suit your purposes as-is, but I imagine it would be possible to edit the source of this plugin and change it to synchronise an entire directory, too.