Pyvmomi - Assign VM to specific folder with non-unique name - python-3.4

I'm trying to figure out how to assign a VM to a folder that does not contain a unique name. I'm currently testing with the clone_vm.py template. With the sample, I have the ability to set the folder, but it does not work correctly if there's nested folders with the same name (example below). I would like to make sure the folder assigned is the "Linux/Dev" folder, but I can only pass "Dev" and hope that it picks the right one. The line of code below is how the folder is being set.
destfolder = get_obj(content, [vim.Folder], vm_folder)
Linux
|------Dev
|------Prod
Windows
|------Dev
|------Prod
Thanks!

The best way to do that is to use a search_index.FindByInventoryPath and get the folder by the path. It can be a little confusing because of hidden folders but the MOB can help you. I answered a question where I covered how to use that search method see this answer.

Related

JavaParser SymbolSolver and JGit to find method qualified name for a given commit

Consider the following code:
mt.resolve().getQualifiedSignature();
Here mt is of type MethodDeclaration, and it might come from a MethodCallExpr.
Now in order it to work accurately, I need to set the following:
CombinedTypeSolver combinedTypeSolver = new CombinedTypeSolver();
combinedTypeSolver.add(new ReflectionTypeSolver());
combinedTypeSolver.add(new JavaParserTypeSolver(new File("src/java1/")));
combinedTypeSolver.add(new JavaParserTypeSolver(new File("src/java2/
")));
This is easy, except I have two issues considering my scenario.
1) I can not set the root source directories manually. I need to find them automatically.
2) I can not give path like the above, because I am using jGit to checkout to different commits. So the paths are not fixed and might vary based on the different checkout commits. So the path should be accessed using JGit tree.
Any help would be highly appreciated.

How to include dependent projects XML-comment files during a publish?

When I use the "normal" "Publish-tool" built into Visual Studio for ASP.net, it seems like it does not include XML-comment-files that belongs to dependent projects/assemblies.
For instance, lets say we have two projects:
Presentation = The Web-application
Definitions = A project
containing definitions of models
The presentation-project has a dependency to the Definition-project.
The presentation-project has XML-comments enabled, and so does the Definition-project (for all configurations).
The presentation-project has a few comments added to the actions of its controller(s).
The definition-project has a few comments added to the properties of the model(s).
The expected result would be that when I publish the Presentation-project, we should end up with two XML- files in the bin folder:
Presentation.xml
Definitions.xml
The names might of course alter if any other name has been specified in the build-properties of each project.
The actual result is that only Presentation.xml is published to the bin-folder.
I have tried to link resulting Definitions.xml-file to the Presentation-project as setting it as "Content" and to always copy, that ended up in the file getting copied to the root-folder of the application during a publish and not the /bin-folder.
I have tried the same thing but linked it into the bin-folder of the Presentation-project, but that ened up with the result of the Definitions.xml-file ending up at /bin/bin/Definitions.xml.
I have tried linking and setting Always, but that did nothing.
Here is a simple sample that can be used to reconstruct the problem:
https://github.com/Inx51/publishdemo
However.. one thing to notice is that the Definitions.xml-file is indeed copied to the /bin-folder during build, but its not copied once using publish.
Anyone that has a workaround for this strange behaviour?
Edit your project XML file, .csproj/.vbproj, and include this in the first PropertyGroup:
<ExcludeXmlAssemblyFiles>false</ExcludeXmlAssemblyFiles>
This will include all the .xml of all dependent assemblies.

Change the name of TaggerProvider and the code fails to work

I cloned https://github.com/microsoft/VSSDK-Extensibility-Samples, the project Intra-text_Adornment/C# works perfectly.
Then I changed the name of ColorAdornmentTaggerProvider to CCAdornmentTaggerProvider, then run the project. The extension doesn't work any more.
My change is https://github.com/gqqnbig/VSSDK-Extensibility-Samples/commit/575d74300fc22b61d694f0c7f6a05e71c7fd79fe
How do I fix it?
How do I fix it?
When you changed the name of ColorAdornmentTaggerProvider to CCAdornmentTaggerProvider, you need to change all Color-related class to CC-related ones to make the extension work.
Trying renaming the Class name in solution explorer and choose OK when you get this messagebox to rename all Colorxxx code elements to CCxxx.
After renaming the class name, the structure should be similar to this:
Then you can get the extension work after fixing the compile errors if exist.
I find another way to fix it. I have to uninstall my extension from the experimental instance, or delete folder %LOCALAPPDATA%\Microsoft\VisualStudio\15.0_5c91ae55Exp\Extensions.
My guess is that since ColorAdornmentTaggerProvider has the Export attribute, when VS is installing the extension, VS remembers the class name, ContentType, TagType, and sort of things. When I rename the class to CCAdornmentTaggerProvider, the extension didn't get reinstalled, the experimental instance is still looking for ColorAdornmentTaggerProvider, but cannot find it.

changing file names, how to?

I've created some forms following this approach:
iron g:template cars/create_car
and the following files were created:
create_car.css
create_car.html
create_car.js
Easy question - if I want to change the name of the files where else do I have to update to keep my changes in sync with the rest of the application?
Thank you!
Mark
You won't be out of sync by changing file's name.
The only things which would change is the file load order, according to the documentation:
HTML template files are always loaded before everything else.
Files beginning with main. are loaded last
Files inside any lib/ directory are loaded next
Files with deeper paths are loaded next
Files are then loaded in alphabetical order of the entire path
On your case It's wouldn't probably cause any issue, feel free to test.

I'm having problems with configuring a filter that replicates specific tables only

I am trying to use filters to select specific tables to replicate.
I tried running this with the installer
./tools/tungsten-installer --master-slave -a \
...
--svc-extractor-filters=replicate \
--property=replicator.filter.replicate.do=test,*.foo"
and got this exception in trepctl status after the master had not installed properly:
Plugin class name property is missing or null: key=replicator.filter.replicate
which file is this properties file? How do I find it? Moreover, in specifying the settings for the filter, how do I know what exactly to put?
I discovered that I am supposed to Modify the configuration template file prior to configuration according to Issue 219 but what changes am I supposed to make in tungsten-replicator-2.0.5-diff that will later on be patched to the extraction?
Issue 254 suggests that If you want to apply a filter out of the box, you can use these options with tungsten-installer:
-a --property=replicator.filter.Replicate.ignoreFilter=schema_x.tablex,schema_x,tabley,schema_y,tablez
--svc-thl-filter=Replicate
However when I try using this for --property=replicator.filter.replicate.do,
but the problem is still the same:
pendingExceptionMessage: Plugin class name property is missing or null: key=replicator.filter.replicate
Your assistance will be greatly appreciated.
Rumbi
Update:
Hi
I had a look at this file: /root/tungsten/tungsten-replicator/samples/
conf/filters/default/tableignore.tpl .Acoording to this sample, a
static-SERVICE_NAME.properties file is supposed to have something like
this configured, please confirm if this is the correct syntax:
replicator.filter.tabledo=com.continuent.tungsten.replicator.filter.JavaScr iptFilter
replicator.filter.tabledo.script=${replicator.home.dir}/samples/
scripts/javascript-advanced/tabledo.js
replicator.filter.tabledo.tables=foo(database).bar(table)
replicator.stage.thl-to-dbms.filters=tabledo
However, I did not find tabledo.js (or something similar) in the
directory where tableignore.js exists. Could I please have the
location of this file. If there is an alternative way of specifiying
--property=replicator.filter.replicate.do=test without the use of
this .js file, your suggestions are most welcome.
Download the latest version of tungsten replicator. The missing tpl file was added about a month ago. After installation, the filtered tables should be added to static-service.properties under the section FILTERS.
Locate your replicator configuration file in static-YOUR_SERVICE_NAME.properties, e.g.
/opt/continuent/tungsten/tungsten-replicator/conf/static-mysql2vertica.properties
Make sure the individual dbms properties are set, in particular the setting replicator.applier.dbms:
# Batch applier basic configuration information.
replicator.applier.dbms=com.continuent.tungsten.replicator.applier.batch.SimpleBatchApplier
replicator.applier.dbms.url=jdbc:mysql:thin://${replicator.global.db.host}:${replicator.global.db.port}/tungsten_${service.name}?createDB=true
replicator.applier.dbms.driver=org.drizzle.jdbc.DrizzleDriver
replicator.applier.dbms.user=${replicator.global.db.user}
replicator.applier.dbms.password=${replicator.global.db.password}
replicator.applier.dbms.startupScript=${replicator.home.dir}/samples/scripts/batch/mysql-connect.sql
# Timezone and character set.
replicator.applier.dbms.timezone=GMT+0:00
replicator.applier.dbms.charset=UTF-8
# Parameters for loading and merging via stage tables.
replicator.applier.dbms.stageTablePrefix=stage_xxx_
replicator.applier.dbms.stageDirectory=/tmp/staging
replicator.applier.dbms.stageLoadScript=${replicator.home.dir}/samples/scripts/batch/mysql-load.sql
replicator.applier.dbms.stageMergeScript=${replicator.home.dir}/samples/scripts/batch/mysql-merge.sql
replicator.applier.dbms.cleanUpFiles=false
Depending on the database you are replicating to you may have to omit/modify some of the lines.
For more information see:
https://code.google.com/p/tungsten-replicator/wiki/Replicator_Batch_Loading
I don't know if this problem is still open or not.
I am using this version 2.0.6-xxx and installing the service using the parameters works for me.
I would like to point it out, that as the parameter says "--svc-extractor-filters" defines an extractor filter. Meaning that the parameters will guide the extraction of data in the master server.
If you intend to use it on the slave service, you should use the "--svc-applier-filters".
The parameters
--svc-extractor-filters=replicate \
--property=replicator.filter.replicate.do=test,*.foo"
supposed to create the following in the properties file:
This is the filter set up.
replicator.filter.replicate=com.continuent.tungsten.replicator.filter.ReplicateFilter
replicator.filter.replicate.ignore=
replicator.filter.replicate.do=test,*.foo
And you should also be able to find the
replicator.stage.binlog-to-q.filters=replicate
parameter set.
If you intend to use this filter in the slave, please find the line with:
replicator.stage.q-to-dbms.filters=mysqlsessions,pkey,bidiSlave
and change it as
replicator.stage.q-to-dbms.filters=mysqlsessions,pkey,bidiSlave,replicate
Hope this brief description did help to you!

Resources