Shows the number of results returned by a query to ServiceNow
Add the following to your Gemfile
gem 'rs_service_now'
| unset $LOCKED | |
| LOCKFILE="/tmp/lockfile" | |
| function waitlock | |
| { | |
| while [ -d "$LOCKFILE" ]; do | |
| sleep 10 | |
| done | |
| } | |
| function lock |
| perl -e 'use strict; my %a; my $a; $a{"1"} = 0; $a = 1; print "$a{$a}\n$a\n";' |
| my $datastoreSystem = Vim::get_view(mo_ref => $host->configManager->datastoreSystem); | |
| my @unbound = $datastoreSystem->QueryUnresolvedVmfsVolumes(); | |
| foreach my $dstore (@unbound) { | |
| my $volume = ${$dstore}[0]; | |
| if($volume->{'vmfsLabel'} ne $vmfsLabel) { | |
| print "Unresolved VMFS volume ".$volume->{'vmfsLabel'}." found but does not match ".$vmfsLabel."\n"; | |
| next; | |
| } | |
| my @extpaths; |
| @unbound_volumes = host.configManager.datastoreSystem.QueryUnresolvedVmfsVolumes | |
| fail "No unresolved VMFS volumes found" if @unbound_volumes.empty? | |
| @volume = nil | |
| @unbound_volumes.each do |dstore| | |
| next unless dstore.is_a? RbVmomi::VIM::HostUnresolvedVmfsVolume | |
| # Unless this volume matches our vmfsLabel skip it |
| function(newDoc, oldDoc, userCtx, secObj) { | |
| for (var field in newDoc) { | |
| if(/^_/.test(field) == false && typeof newDoc[field] == "string") { | |
| if(/^(\{|\[)/.test(newDoc[field])) { | |
| throw ({forbidden : field + " field doesn't contain valid JSON:\n" + newDoc[field]}); | |
| } | |
| } | |
| } | |
| } |
| def javascript_class_type value | |
| class_of = lambda { |klass| value.kind_of?(klass) } | |
| case | |
| when class_of.call(String) | |
| return "string" | |
| when class_of.call(Fixnum), class_of.call(Float) | |
| return "number" | |
| when class_of.call(FalseClass), class_of.call(TrueClass) | |
| return "boolean" | |
| when class_of.call(Array) |
| # I can't believe I'm doing this horrible hack, but Puppet 2.7 doesn't support | |
| # Ruby versions above 1.8.7. Due to all the testing requirements | |
| # we need to run Ruby 1.9.3. The only bug I've hit so far with Puppet 2.7 | |
| # and Ruby 1.9.3 is the lack of a "collect" method for a String | |
| # which just needs to return an array of itself | |
| # Turns out this is an undocumented feature in Ruby 1.8 | |
| # | |
| # Add this to your spec_helper.rb file for use with rspec-puppet | |
| class String | |
| def collect |
| This package was debianized by: | |
| Emmanuel Bouthenot <[email protected]> on Sun, 22 Feb 2009 16:00:59 +0000 | |
| It was downloaded from: | |
| http://code.google.com/p/wkhtmltopdf/ | |
| Upstream Authors: | |
| Jakob Truelsen <[email protected]> | |
| Copyright: |
| -module(chop). | |
| -export([guess/3]). | |
| -define(equal(Actual, Guess), Guess == Actual). | |
| -define(lower(Actual, Guess), Guess > Actual). | |
| guess(Actual, First, Last) -> | |
| Guess = binary_guess(First, Last), |