How to identify a vCenter locator in vSphere? - virtual-machine

When deploying an OVA/OVF file to vCenter, ovftool requires a locator.
The example locator in the user guide looks like this: vi://user#localhost/Datacenter
When I look at the vCenter path with vSphere, the hierarchy we have set up is:
- Location
-- Department with Spaces
--- security_group
Perhaps my assumption that this hierarchy is the locator is incorrect, because vi://user#localhost/Location/Department\ with\ Spaces/security_group just returns Error: Cannot parse VI locator.
Is there a way in vSphere to determine the correct locator of a vcenter for an ovftool deployment?

If you are specifying the --datastore, you'll want to use the ovftool auto-complete to suggest your path. So in my case, I used vi://user:password#localhost/Location/host to identify both the vCenter locator and the datastore. When you reach the end of the autocompletion, you have your datastore value "Datastores found on target:", and the path prior is your locator.

Related

is there some way to get all the invalid locators in selenium automation?

I have many locators and if any one among them fails the program fails, We can not get a list of locators failed.
is there some way/method to get all the invalid locators in selenium automation???
The easy way (in case of you're using a framework and the code is well structured) :
Add the action performed on any locator into a try-catch block and store locator's name into a file, log it into console etc (it's up to you). In this way, you can follow up and update them after.
The manual way:
Go manually trough all your locators and look after them in HTML code in browser's console
The less painful manual way:
Execute all tests, and from your report (if you're using any reporting tool) or from console, collect and check each locator .
Now, if you're just doing a clean-up, I recommend the first approach. If you're facing issues with the locators, flaky situations, I recommend creating dynamic locators (xpath or css).

How to let Selenium Driver resolve hostname to another ip?

Currently our tests have a specific hostname in the url (eg. http://foo.bar/whatever)
We want to resolve foo.bar to a different IP when running the tests.
Manually we would do this by changing the host file or using this piece of c# code:
var request = (HttpWebRequest)WebRequest.Create("http://ip-of-foobar/whatever");
request.Host = "foo.bar";
We need to have the correct hostname... maybe there is another way setting request headers in Selenium?
From my knowledge, there is NO API in selenium to set the IP of the server you want to open the browser. get() takes the URL which contains the domain name or IP address. you can not set the value as you set using C# libraries.
As you want to change the domain name to IP address, following are the two options available:
Keep the IP address in a file. Use the language libraries to read the value from the file and set it to a variable. Use that variable wherever you are referencing the URL. example: driver.get("http://"+variable+"/") to get the home page.
Use the test framework capabilities. parameterization (parameter in testng, example) or data references. This allows you to define the value outside the code and then refer the value using a variable name in the code. Same as the first option, but avoids File reading activity. During the run, change the value, so it will be reflected everywhere.
please let us know the language and framework you are using, so I can try to give the exact solution based on above options.

Is there a way to pass extra information on a Selenium Grid request?

I'm trying to see if there is a way to pass extra information to the hub from a given request.
The capabilities has the ability to ignore parameters which aren't used, but I wondering if there was a way they could be echoed to the grid UI console?
Key examples could be logon user, IP / Machine name it was sent from etc.
Is this possible?
Cheers,
Jamie
It seems after restarting the hub, I can now see abc-whoami and abc-executingfrom parameters i've added in. Just add this to the list of desiredcapabilities and ensure your availability matcher (if custom) ignores these values.

Configuration for PowerShell module created via .NET framework

What's the best practice when you have dependencies that you want to be able to configure when creating a PowerShell module in C#?
My specific scenario is that the PowerShell module I am creating via C# code will use a WCF service. Hence, the service's URL must be something that the clients can configure.
Is there a standard approach on this? Or will this be something that must be custom implemented?
A somewhat standard way to do this is to allow a value to be provided as a parameter or default to reading special variable via PSCmdlet's GetVariableValue. This is what the built-in Send-MailMessage cmdlet does. It reads the variable PSEmailServer if no server is provided.
I might not be understanding your question. So I'll posit a few scenarios:
You PS module will always use the same WCF endpoint. In that case you could hardcode the URL in the module
You have a limited number of endpoints to choose from, and there's some algorithm or best practice to associate an endpoint with a particular user, such as the closest geographically, based on the dept or division the user is in, etc.
It's completely up to the end user's preference to choose a URL.
For case #2, I suggest you implement the algorithm/best practice and save the result someplace - as part of the module install.
For case #3, using an environment variable seems reasonable, or a registry setting, or a file in one of the user's profile directories. Probably more important than where you persist the data though, is the interface you give users to change the setting. For example if you used an environment variable, it would be less friendly to tell the user to go to Control Panel, System, Advanced, Environment, User variable, New..., than to provide a simple PS function to change the URL. In fact I'd say providing a cmdlet/function to perform configuration is the closest to a "standard" I can think of.

What is the possible reason and fix for this exception regarding bitronix configuration in MOQUI

When I start the server I get an exception like :
bitronix.tm.Configuration
cannot get this JVM unique ID. Make sure it is configured and you only use ASCII characters. Will use IP address instead (unsafe for production usage!)
What is the reason for this kind of exception and how can I fix this, when loading my component to production instance?
This is part of Bitronix configuration, the "bitronix.tm.serverId" property in the bitronix-default-config.properties file. See the docs for more details here:
http://docs.codehaus.org/display/BTM/Configuration2x