# File lib/puppet/type/file.rb, line 602 def remove_existing(should) return unless s = stat self.fail "Could not back up; will not replace" unless perform_backup unless should.to_s == "link" return if s.ftype.to_s == should.to_s end case s.ftype when "directory" if self[:force] == :true debug "Removing existing directory for replacement with #{should}" FileUtils.rmtree(self[:path]) else notice "Not removing directory; use 'force' to override" return end when "link", "file" debug "Removing existing #{s.ftype} for replacement with #{should}" ::File.unlink(self[:path]) else self.fail "Could not back up files of type #{s.ftype}" end @stat = :needs_stat true end
This is to fix bug #2296, where two files recurse over the same set of files. It’s a rare case, and when it does happen you’re not likely to have many actual conflicts, which is good, because this is a pretty inefficient implementation.
# File lib/puppet/type/file.rb, line 499 def remove_less_specific_files(files) # REVISIT: is this Windows safe? AltSeparator? mypath = self[:path].split(::File::Separator) other_paths = catalog.vertices. select { |r| r.is_a?(self.class) and r[:path] != self[:path] }. collect { |r| r[:path].split(::File::Separator) }. select { |p| p[0,mypath.length] == mypath } return files if other_paths.empty? files.reject { |file| path = file[:path].split(::File::Separator) other_paths.any? { |p| path[0,p.length] == p } } end
# File lib/puppet/provider/user/user_role_add.rb, line 125 def remove_managed_attributes managed = managed_attributes user_attributes.select { |k,v| !managed.include?(k) }.inject({}) { |hash, array| hash[array[0]] = array[1]; hash } end
# File lib/puppet/provider/service/upstart.rb, line 289 def remove_manual_from(text) text.gsub(MANUAL, "") end
# File lib/puppet/provider/service/upstart.rb, line 281 def remove_trailing_comments_from(line) line.gsub(/^(\s*[^#]*).*/, '\1') end
# File lib/puppet/provider/service/upstart.rb, line 277 def remove_trailing_comments_from_commented_line_of(line) line.gsub(/^(\s*#+\s*[^#]*).*/, '\1') end
# File lib/puppet/network/formats.rb, line 14 def render(instance) instance.to_yaml end
# File lib/puppet/face/help.rb, line 78 def render_application_help(applicationname) return Puppet::Application[applicationname].help end
# File lib/puppet/face/help.rb, line 82 def render_face_help(facename, actionname, version) face, action = load_face_help(facename, actionname, version) return template_for(face, action).result(binding) end
Yaml monkey-patches Array, so this works.
# File lib/puppet/network/formats.rb, line 19 def render_multiple(instances) instances.to_yaml end
# File lib/puppet/network/formats.rb, line 39 def requiring_zlib if use_zlib? yield else raise Puppet::Error, "the zlib library is not installed or is disabled." end end
# File lib/puppet/type/resources.rb, line 104 def resource_type unless defined?(@resource_type) unless type = Puppet::Type.type(self[:name]) raise Puppet::DevError, "Could not find resource type" end @resource_type = type end @resource_type end
# File lib/puppet/provider/service/daemontools.rb, line 182 def restart svc "-t", self.service end
# File lib/puppet/provider/service/init.rb, line 123 def restartcmd (@resource[:hasrestart] == :true) && [initscript, :restart] end
if the onlyif resource is provided, then the value is parsed. a return value of 0 will stop exection because it matches the default value.
# File lib/puppet/type/augeas.rb, line 208 def retrieve if @resource.provider.need_to_run?() :need_to_run else 0 end end
# File lib/puppet/provider/macauthorization/macauthorization.rb, line 241 def retrieve_value(resource_name, attribute) # We set boolean values to symbols when retrieving values raise Puppet::Error.new("Cannot find #{resource_name} in auth db") if not self.class.parsed_auth_db.has_key?(resource_name) if PuppetToNativeAttributeMap.has_key?(attribute) native_attribute = PuppetToNativeAttributeMap[attribute] else native_attribute = attribute.to_s end if self.class.parsed_auth_db[resource_name].has_key?(native_attribute) value = self.class.parsed_auth_db[resource_name][native_attribute] case value when true, :true value = :true when false, :false value = :false end @property_hash[attribute] = value return value else @property_hash.delete(attribute) return "" # so ralsh doesn't display it. end end
# File lib/puppet/provider/user/user_role_add.rb, line 105 def roles user_attributes[:roles] if user_attributes end
# File lib/puppet/provider/exec/shell.rb, line 18 def run(command, check = false) super(['/bin/sh', '-c', command], check) end
# File lib/puppet/provider/package/pkgutil.rb, line 150 def run_pkgutil(resource, *args) # Allow source to be one or more URLs pointing to a repository that all # get passed to pkgutil via one or more -t options if resource[:source] sources = [resource[:source]].flatten pkguti *[sources.map{|src| [ "-t", src ]}, *args].flatten else pkguti *args.flatten end end
preseeds answers to dpkg-set-selection from the “responsefile”
# File lib/puppet/provider/package/apt.rb, line 87 def run_preseed if response = @resource[:responsefile] and FileTest.exist?(response) self.info("Preseeding #{response} to debconf-set-selections") preseed response else self.info "No responsefile specified or non existant, not preseeding anything" end end
The iterations and salt properties, like the password property, can only be modified by directly changing the user’s plist. Because of this fact, we have to treat the ds cache just like you would in the password= method.
# File lib/puppet/provider/user/directoryservice.rb, line 421 def salt=(value) if (Puppet::Util::Package.versioncmp(self.class.get_os_version, '10.7') > 0) sleep 2 flush_dscl_cache users_plist =<EMAIL_ADDRESS>shadow_hash_data = get_shadow_hash_data(users_plist) set_salted_pbkdf2(users_plist, shadow_hash_data, 'salt', value) flush_dscl_cache end end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 475 def scheduler_days_of_week [ Win32::TaskScheduler::SUNDAY, Win32::TaskScheduler::MONDAY, Win32::TaskScheduler::TUESDAY, Win32::TaskScheduler::WEDNESDAY, Win32::TaskScheduler::THURSDAY, Win32::TaskScheduler::FRIDAY, Win32::TaskScheduler::SATURDAY ] end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 487 def scheduler_months [ Win32::TaskScheduler::JANUARY, Win32::TaskScheduler::FEBRUARY, Win32::TaskScheduler::MARCH, Win32::TaskScheduler::APRIL, Win32::TaskScheduler::MAY, Win32::TaskScheduler::JUNE, Win32::TaskScheduler::JULY, Win32::TaskScheduler::AUGUST, Win32::TaskScheduler::SEPTEMBER, Win32::TaskScheduler::OCTOBER, Win32::TaskScheduler::NOVEMBER, Win32::TaskScheduler::DECEMBER ] end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 504 def scheduler_occurrences [ Win32::TaskScheduler::FIRST_WEEK, Win32::TaskScheduler::SECOND_WEEK, Win32::TaskScheduler::THIRD_WEEK, Win32::TaskScheduler::FOURTH_WEEK, Win32::TaskScheduler::LAST_WEEK ] end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 465 def scheduler_trigger_types [ Win32::TaskScheduler::TASK_TIME_TRIGGER_DAILY, Win32::TaskScheduler::TASK_TIME_TRIGGER_WEEKLY, Win32::TaskScheduler::TASK_TIME_TRIGGER_MONTHLYDATE, Win32::TaskScheduler::TASK_TIME_TRIGGER_MONTHLYDOW, Win32::TaskScheduler::TASK_TIME_TRIGGER_ONCE ] end
# File lib/puppet/provider/service/init.rb, line 82 def search(name) paths.each { |path| fqname = File.join(path,name) begin stat = File.stat(fqname) rescue # should probably rescue specific errors... self.debug("Could not find #{name} in #{path}") next end # if we've gotten this far, we found a valid script return fqname } paths.each { |path| fqname_sh = File.join(path,"#{name}.sh") begin stat = File.stat(fqname_sh) rescue # should probably rescue specific errors... self.debug("Could not find #{name}.sh in #{path}") next end # if we've gotten this far, we found a valid script return fqname_sh } raise Puppet::Error, "Could not find init script for '#{name}'" end
# File lib/puppet/provider/selmodule/semodule.rb, line 67 def selmod_name_to_filename if @resource[:selmodulepath] return @resource[:selmodulepath] else return "#{@resource[:selmoduledir]}/#{@resource[:name]}.pp" end end
# File lib/puppet/provider/selmodule/semodule.rb, line 75 def selmod_readnext (handle) len = handle.read(4).unpack('L')[0] handle.read(len) end
# File lib/puppet/provider/selmodule/semodule.rb, line 80 def selmodversion_file magic = 0xF97CFF8F filename = selmod_name_to_filename mod = File.new(filename, "r") (hdr, ver, numsec) = mod.read(12).unpack('LLL') raise Puppet::Error, "Found #{hdr} instead of magic #{magic} in #{filename}" if hdr != magic raise Puppet::Error, "Unknown policy file version #{ver} in #{filename}" if ver != 1 # Read through (and throw away) the file section offsets, and also # the magic header for the first section. mod.read((numsec + 1) * 4) ## Section 1 should be "SE Linux Module" selmod_readnext(mod) selmod_readnext(mod) # Skip past the section headers mod.read(14) # Module name selmod_readnext(mod) # At last! the version v = selmod_readnext(mod) self.debug "file version #{v}" v end
# File lib/puppet/provider/selmodule/semodule.rb, line 116 def selmodversion_loaded lines = () begin execpipe("#{command(:semodule)} --list") do |output| output.each_line do |line| line.chomp! bits = line.split if bits[0] == @resource[:name] self.debug "load version #{bits[1]}" return bits[1] end end end rescue Puppet::ExecutionFailure raise Puppet::ExecutionFailure, "Could not list policy modules: #{lines.join(' ').chomp!}" end nil end
Send the email reports.
# File lib/puppet/reports/tagmail.rb, line 132 def send(reports) pid = Puppet::Util.safe_posix_fork do if Puppet[:smtpserver] != "none" begin Net::SMTP.start(Puppet[:smtpserver]) do |smtp| reports.each do |emails, messages| smtp.open_message_stream(Puppet[:reportfrom], *emails) do |p| p.puts "From: #{Puppet[:reportfrom]}" p.puts "Subject: Puppet Report for #{self.host}" p.puts "To: " + emails.join(", ") p.puts "Date: #{Time.now.rfc2822}" p.puts p.puts messages end end end rescue => detail message = "Could not send report emails through smtp: #{detail}" Puppet.log_exception(detail, message) raise Puppet::Error, message end elsif Puppet[:sendmail] != "" begin reports.each do |emails, messages| # We need to open a separate process for every set of email addresses IO.popen(Puppet[:sendmail] + " " + emails.join(" "), "w") do |p| p.puts "From: #{Puppet[:reportfrom]}" p.puts "Subject: Puppet Report for #{self.host}" p.puts "To: " + emails.join(", ") p.puts messages end end rescue => detail message = "Could not send report emails via sendmail: #{detail}" Puppet.log_exception(detail, message) raise Puppet::Error, message end else raise Puppet::Error, "SMTP server is unset and could not find sendmail" end end # Don't bother waiting for the pid to return. Process.detach(pid) end
returns the full path of this service when enabled (ie in the service directory)
# File lib/puppet/provider/service/daemontools.rb, line 104 def service File.join(self.servicedir, resource[:name]) end
Extract service name
# File lib/puppet/provider/service/freebsd.rb, line 31 def service_name name = self.rcvar[0] self.error("No service name found in rcvar") if name.nil? name = name.gsub!(/# (.*)/, '\1') self.error("Service name is empty") if name.nil? self.debug("Service name is #{name}") name end
find the service dir on this node
# File lib/puppet/provider/service/daemontools.rb, line 89 def servicedir unless @servicedir ["/service", "/etc/service","/var/lib/svscan"].each do |path| if FileTest.exist?(path) @servicedir = path break end end raise "Could not find service directory" unless @servicedir end @servicedir end
# File lib/puppet/provider/augeas/augeas.rb, line 307 def set_augeas_save_mode(mode) @aug.set("/augeas/save", mode) end
# File lib/puppet/provider/macauthorization/macauthorization.rb, line 179 def set_right(name, values) # Both creates and modifies rights as it simply overwrites them. # The security binary only allows for writes using stdin, so we # dump the values to a tempfile. values = convert_plist_to_native_attributes(values) tmp = Tempfile.new('puppet_macauthorization') begin Plist::Emit.save_plist(values, tmp.path) cmds = [] cmds << :security << "authorizationdb" << "write" << name output = execute(cmds, :failonfail => false, :combine => false, :stdinfile => tmp.path.to_s) rescue Errno::EACCES => e raise Puppet::Error.new("Cannot save right to #{tmp.path}: #{e}") ensure tmp.close tmp.unlink end end
# File lib/puppet/provider/macauthorization/macauthorization.rb, line 198 def set_rule(name, values) # Both creates and modifies rules as it overwrites the entry in the # rules dictionary. Unfortunately the security binary doesn't # support modifying rules at all so we have to twiddle the whole # plist... :( See Apple Bug #6386000 values = convert_plist_to_native_attributes(values) authdb = Plist::parse_xml(AuthDB) authdb["rules"][name] = values begin Plist::Emit.save_plist(authdb, AuthDB) rescue raise Puppet::Error.new("Error writing to: #{AuthDB}") end end
This method accepts a passed value and one of three fields: ‘salt’, ‘entropy’, or ‘iterations’. These fields correspond with the fields utilized in a PBKDF2 password hashing system (see en.wikipedia.org/wiki/PBKDF2 ) where ‘entropy’ is the password hash, ‘salt’ is the password hash salt value, and ‘iterations’ is an integer recommended to be > 10,000. The remaining arguments are the user’s plist itself, and the shadow_hash_data hash containing the existing PBKDF2 values.
# File lib/puppet/provider/user/directoryservice.rb, line 610 def set_salted_pbkdf2(users_plist, shadow_hash_data, field, value) shadow_hash_data = Hash.new unless shadow_hash_data shadow_hash_data['SALTED-SHA512-PBKDF2'] = Hash.new unless shadow_hash_data['SALTED-SHA512-PBKDF2'] case field when 'salt', 'entropy' shadow_hash_data['SALTED-SHA512-PBKDF2'][field] = new_stringio_object unless shadow_hash_data['SALTED-SHA512-PBKDF2'][field] shadow_hash_data['SALTED-SHA512-PBKDF2'][field].string = base64_decode_string(value) when 'iterations' shadow_hash_data['SALTED-SHA512-PBKDF2'][field] = Integer(value) else raise Puppet::Error "Puppet has tried to set an incorrect field for the 'SALTED-SHA512-PBKDF2' hash. Acceptable fields are 'salt', 'entropy', or 'iterations'." end # on 10.8, this field *must* contain 8 stars, or authentication will # fail. users_plist['passwd'] = ('*' * 8) # Convert shadow_hash_data to a binary plist, and call the # set_shadow_hash_data method to serialize and write the data # back to the user's plist. binary_plist = self.class.convert_xml_to_binary(shadow_hash_data) set_shadow_hash_data(users_plist, binary_plist) end
Puppet requires a salted-sha512 password hash for 10.7 users to be passed in Hex, but the embedded plist stores that value as a Base64 encoded string. This method converts the string and calls the set_shadow_hash_data method to serialize and write the plist to disk.
# File lib/puppet/provider/user/directoryservice.rb, line 592 def set_salted_sha512(users_plist, shadow_hash_data, value) unless shadow_hash_data shadow_hash_data = Hash.new shadow_hash_data['SALTED-SHA512'] = new_stringio_object end shadow_hash_data['SALTED-SHA512'].string = base64_decode_string(value) binary_plist = self.class.convert_xml_to_binary(shadow_hash_data) set_shadow_hash_data(users_plist, binary_plist) end
This method will embed the binary plist data comprising the user’s password hash (and Salt/Iterations value if the OS is 10.8 or greater) into the ShadowHashData key of the user’s plist.
# File lib/puppet/provider/user/directoryservice.rb, line 563 def set_shadow_hash_data(users_plist, binary_plist) if users_plist.has_key?('ShadowHashData') users_plist['ShadowHashData'][0].string = binary_plist else users_plist['ShadowHashData'] = [new_stringio_object(binary_plist)] end write_users_plist_to_disk(users_plist) end
Set the checksum, from another property. There are multiple properties that modify the contents of a file, and they need the ability to make sure that the checksum value is in sync.
# File lib/puppet/type/file.rb, line 640 def setchecksum(sum = nil) if @parameters.include? :checksum if sum @parameters[:checksum].checksum = sum else # If they didn't pass in a sum, then tell checksum to # figure it out. currentvalue = @parameters[:checksum].retrieve @parameters[:checksum].checksum = currentvalue end end end
Execute a configuration string. Can’t be private because it’s called by the properties.
# File lib/puppet/provider/zone/solaris.rb, line 250 def setconfig(str) add_cmd str end
Take the results of a listing and set everything appropriately.
# File lib/puppet/type/zone.rb, line 360 def setstatus(hash) prophash = {} hash.each do |param, value| next if param == :name case self.class.attrtype(param) when :property # Only try to provide values for the properties we're managing prop = self.property(param) prophash[prop] = value if prop else self[param] = value end end prophash end
JJM Yes, this is not DRY at all. Because of the code blocks autorequire must be done this way. I think.
# File lib/puppet/type/mcx.rb, line 74 def setup_autorequire(type) # value returns a Symbol name = value(:name) ds_type = value(:ds_type) ds_name = value(:ds_name) if ds_type == type rval = [ ds_name.to_s ] else rval = [ ] end rval end
# File lib/puppet/provider/service/daemontools.rb, line 127 def setupservice if resource[:manifest] Puppet.notice "Configuring #{resource[:name]}" command = [ resource[:manifest], resource[:name] ] #texecute("setupservice", command) rv = system("#{command}") end rescue Puppet::ExecutionFailure => detail raise Puppet::Error.new( "Cannot config #{self.service} to enable it: #{detail}" ) end
Read in /etc/shadow, find the line for this user (skipping comments, because who knows) and return it No abstraction, all esoteric knowledge of file formats, yay
# File lib/puppet/provider/user/user_role_add.rb, line 159 def shadow_entry return @shadow_entry if defined? @shadow_entry @shadow_entry = File.readlines(target_file_path). reject { |r| r =~ /^[^\w]/ }. collect { |l| l.chomp.split(':') }. find { |user, _| user == @resource[:name] } end
# File lib/puppet/provider/package/msi.rb, line 128 def shell_quote(value) value.include?(' ') ? %["#{value.gsub(/"/, '\"')}"] : value end
# File lib/puppet/type/cron.rb, line 216 def should if @should if @should.is_a? Array @should[0] else devfail "command is not an array" end else nil end end
Should this thing be a normal file? This is a relatively complex way of determining whether we’re trying to create a normal file, and it’s here so that the logic isn’t visible in the content property.
# File lib/puppet/type/file.rb, line 656 def should_be_file? return true if self[:ensure] == :file # I.e., it's set to something like "directory" return false if e = self[:ensure] and e != :present # The user doesn't really care, apparently if self[:ensure] == :present return true unless s = stat return(s.ftype == "file" ? true : false) end # If we've gotten here, then :ensure isn't set return true if self[:content] return true if stat and stat.ftype == "file" false end
# File lib/puppet/type/cron.rb, line 327 def should_to_s(newvalue = @should) if newvalue newvalue.join(",") else nil end end
The hidden singleton lurks behind everyone
# File lib/puppet/util/metaid.rb, line 3 def singleton_class; class << self; self; end; end
# File lib/puppet/type/cron.rb, line 234 def specials %{reboot yearly annually monthly weekly daily midnight hourly} end
# File lib/puppet/provider/package/hpux.rb, line 41 def standard_args ["-x", "mount_all_filesystems=false"] end
Run the ‘start’ parameter command, or the specified ‘startcmd’.
# File lib/puppet/provider/service/base.rb, line 64 def start ucommand(:start) end
The command used to start. Generated if the ‘binary’ argument is passed.
# File lib/puppet/provider/service/base.rb, line 70 def startcmd if @resource[:binary] return @resource[:binary] else raise Puppet::Error, "Services must specify a start command or a binary" end end
Stat our file. Depending on the value of the ‘links’ attribute, we use either ‘stat’ or ‘lstat’, and we expect the properties to use the resulting stat object accordingly (mostly by testing the ‘ftype’ value).
We use the initial value :needs_stat to ensure we only stat the file once, but can also keep track of a failed stat (@stat == nil). This also allows us to re-stat on demand by setting @stat = :needs_stat.
# File lib/puppet/type/file.rb, line 682 def stat return @stat unless @stat == :needs_stat method = :stat # Files are the only types that support links if (self.class.name == :file and self[:links] != :follow) or self.class.name == :tidy method = :lstat end @stat = begin ::File.send(method, self[:path]) rescue Errno::ENOENT => error nil rescue Errno::ENOTDIR => error nil rescue Errno::EACCES => error warning "Could not stat; permission denied" nil end end
Check if the process is running. Prefer the ‘status’ parameter, then ‘statuscmd’ method, then look in the process table. We give the object the option to not return a status command, which might happen if, for instance, it has an init script (and thus responds to ‘statuscmd’) but does not have ‘hasstatus’ enabled.
# File lib/puppet/provider/service/base.rb, line 40 def status if @resource[:status] or statuscmd # Don't fail when the exit status is not 0. ucommand(:status, false) # Expicitly calling exitstatus to facilitate testing if $CHILD_STATUS.exitstatus == 0 return :running else return :stopped end elsif pid = self.getpid self.debug "PID is #{pid}" return :running else return :stopped end end
There is no default command, which causes other methods to be used
# File lib/puppet/provider/service/base.rb, line 60 def statuscmd end
Stop the service. If a ‘stop’ parameter is specified, it takes precedence; otherwise checks if the object responds to a ‘stopcmd’ method, and if so runs that; otherwise, looks for the process in the process table. This method will generally not be overridden by submodules.
# File lib/puppet/provider/service/base.rb, line 84 def stop if @resource[:stop] or stopcmd ucommand(:stop) else pid = getpid unless pid self.info "#{self.name} is not running" return false end begin output = kill pid rescue Puppet::ExecutionFailure => detail @resource.fail "Could not kill #{self.name}, PID #{pid}: #{output}" end return true end end
There is no default command, which causes other methods to be used
# File lib/puppet/provider/service/base.rb, line 103 def stopcmd end
# File lib/puppet/type/file/checksum.rb, line 16 def sum(content) type = value || :md5 # because this might be called before defaults are set "{#{type}}" + send(type, content) end
# File lib/puppet/type/file/checksum.rb, line 21 def sum_file(path) type = value || :md5 # because this might be called before defaults are set method = type.to_s + "_file" "{#{type}}" + send(method, path).to_s end
# File lib/puppet/type/file/checksum.rb, line 27 def sum_stream(&block) type = value || :md5 # same comment as above method = type.to_s + "_stream" checksum = send(method, &block) "{#{type}}#{checksum}" end
Unlike core’s yaml, ZAML should support 1.8.1 just fine
# File lib/puppet/network/formats.rb, line 24 def supported?(klass) true end
Actually execute the command.
# File lib/puppet/type/augeas.rb, line 217 def sync @resource.provider.execute_changes end
# File lib/puppet/provider/selmodule/semodule.rb, line 33 def syncversion self.debug "Checking syncversion on #{@resource[:name]}" loadver = selmodversion_loaded if(loadver) then filever = selmodversion_file if (filever == loadver) return :true end end :false end
# File lib/puppet/provider/selmodule/semodule.rb, line 47 def syncversion= (dosync) execoutput("#{command(:semodule)} --upgrade #{selmod_name_to_filename}") rescue Puppet::ExecutionFailure => detail raise Puppet::Error, "Could not upgrade policy module: #{detail}"; end
# File lib/puppet/type/resources.rb, line 128 def system_users %{root nobody bin noaccess daemon sys} end
This helper makes it possible to test this on stub data without having to do too many crazy things!
# File lib/puppet/provider/user/user_role_add.rb, line 152 def target_file_path "/etc/shadow" end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 34 def task return @task if @task @task ||= Win32::TaskScheduler.new @task.activate(resource[:name] + '.job') if exists? @task end
# File lib/puppet/face/help.rb, line 108 def template_for(face, action) if action.nil? erb('face.erb') else erb('action.erb') end end
A simple wrapper so execution failures are a bit more informative.
# File lib/puppet/provider/service/service.rb, line 23 def texecute(type, command, fof = true) begin # #565: Services generally produce no output, so squelch them. execute(command, :failonfail => fof, :override_locale => false, :squelch => true) rescue Puppet::ExecutionFailure => detail @resource.fail "Could not #{type}<EMAIL_ADDRESS>#{detail}" end nil end
Does a given path match our glob patterns, if any? Return true if no patterns have been provided.
# File lib/puppet/type/tidy.rb, line 83 def tidy?(path, stat) basename = File.basename(path) flags = File::FNM_DOTMATCH | File::FNM_PATHNAME return(value.find {|pattern| File.fnmatch(pattern, basename, flags) } ? true : false) end
Unfortunately, RRD does not deal well with changing lists of values, so we have to pick a list of values and stick with it. In this case, that means we record the total time, the config time, and that’s about it. We should probably send each type’s time as a separate metric.
# File lib/puppet/reports/rrdgraph.rb, line 124 def timeclean(metric) metric.values = metric.values.find_all { |name, label, value| ['total', 'config_retrieval'].include?(name.to_s) } end
We want our title to just be the whole reference, rather than @title.
# File lib/puppet/type/component.rb, line 61 def title ref end
# File lib/puppet/type/component.rb, line 65 def title=(str) @reference = Puppet::Resource.new(str) end
# File lib/puppet/provider/mailalias/aliases.rb, line 31 def to_line(record) dest = record[:recipient].collect do |d| # Quote aliases that have non-alpha chars if d =~<EMAIL_ADDRESS>'"%s"' % d else d end end.join(",") "#{record[:name]}: #{dest}" end
# File lib/puppet/util/log/destinations.rb, line 228 def to_native(level) case level when :debug,:info,:notice [Win32::EventLog::INFO, 0x01] when :warning [Win32::EventLog::WARN, 0x02] when :err,:alert,:emerg,:crit [Win32::EventLog::ERROR, 0x03] end end
# File lib/puppet/type/file.rb, line 704 def to_resource resource = super resource.delete(:target) if resource[:target] == :notlink resource end
# File lib/puppet/type/component.rb, line 78 def to_s reference.to_s end
# File lib/puppet/util/monkey_patches.rb, line 38 def to_yaml(ignored=nil) ZAML.dump(self) end
# File lib/puppet/util/zaml.rb, line 173 def to_yaml_properties instance_variables # default YAML behaviour. end
# File lib/puppet/util/zaml.rb, line 183 def to_zaml(z) z.first_time_only(self) { z.emit(zamlized_class_name(Object)) z.nested { instance_variables = to_yaml_properties if instance_variables.empty? z.emit(" {}") else instance_variables.each { |v| z.nl v.to_s[1..-1].to_zaml(z) # Remove leading '@' z.emit(': ') yaml_property_munge(instance_variable_get(v)).to_zaml(z) } end } } end
# File lib/puppet/provider/user/user_role_add.rb, line 73 def transition(type) cmd = [command(:modify)] cmd << "-K" << "type=#{type}" cmd += add_properties cmd << @resource[:name] end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 283 def translate_hash_to_trigger(puppet_trigger, user_provided_input=false) trigger = dummy_time_trigger if user_provided_input self.fail "'enabled' is read-only on triggers" if puppet_trigger.has_key?('enabled') self.fail "'index' is read-only on triggers" if puppet_trigger.has_key?('index') end puppet_trigger.delete('index') if puppet_trigger.delete('enabled') == false trigger['flags'] |= Win32::TaskScheduler::TASK_TRIGGER_FLAG_DISABLED else trigger['flags'] &= ~Win32::TaskScheduler::TASK_TRIGGER_FLAG_DISABLED end extra_keys = puppet_trigger.keys.sort - ['schedule', 'start_date', 'start_time', 'every', 'months', 'on', 'which_occurrence', 'day_of_week'] self.fail "Unknown trigger option(s): #{Puppet::Parameter.format_value_for_display(extra_keys)}" unless extra_keys.empty? self.fail "Must specify 'start_time' when defining a trigger" unless puppet_trigger['start_time'] case puppet_trigger['schedule'] when 'daily' trigger['trigger_type'] = Win32::TaskScheduler::DAILY trigger['type'] = { 'days_interval' => Integer(puppet_trigger['every'] || 1) } when 'weekly' trigger['trigger_type'] = Win32::TaskScheduler::WEEKLY trigger['type'] = { 'weeks_interval' => Integer(puppet_trigger['every'] || 1) } trigger['type']['days_of_week'] = if puppet_trigger['day_of_week'] bitfield_from_days_of_week(puppet_trigger['day_of_week']) else scheduler_days_of_week.inject(0) {|day_flags,day| day_flags |= day} end when 'monthly' trigger['type'] = { 'months' => bitfield_from_months(puppet_trigger['months'] || (1..12).to_a), } if puppet_trigger.keys.include?('on') if puppet_trigger.has_key?('day_of_week') or puppet_trigger.has_key?('which_occurrence') self.fail "Neither 'day_of_week' nor 'which_occurrence' can be specified when creating a monthly date-based trigger" end trigger['trigger_type'] = Win32::TaskScheduler::MONTHLYDATE trigger['type']['days'] = bitfield_from_days(puppet_trigger['on']) elsif puppet_trigger.keys.include?('which_occurrence') or puppet_trigger.keys.include?('day_of_week') self.fail 'which_occurrence cannot be specified as an array' if puppet_trigger['which_occurrence'].is_a?(Array) %{day_of_week which_occurrence}.each do |field| self.fail "#{field} must be specified when creating a monthly day-of-week based trigger" unless puppet_trigger.has_key?(field) end trigger['trigger_type'] = Win32::TaskScheduler::MONTHLYDOW trigger['type']['weeks'] = occurrence_name_to_constant(puppet_trigger['which_occurrence']) trigger['type']['days_of_week'] = bitfield_from_days_of_week(puppet_trigger['day_of_week']) else self.fail "Don't know how to create a 'monthly' schedule with the options: #{puppet_trigger.keys.sort.join(', ')}" end when 'once' self.fail "Must specify 'start_date' when defining a one-time trigger" unless puppet_trigger['start_date'] trigger['trigger_type'] = Win32::TaskScheduler::ONCE else self.fail "Unknown schedule type: #{puppet_trigger["schedule"].inspect}" end if start_date = puppet_trigger['start_date'] start_date = Date.parse(start_date) self.fail "start_date must be on or after 1753-01-01" unless start_date >= Date.new(1753, 1, 1) trigger['start_year'] = start_date.year trigger['start_month'] = start_date.month trigger['start_day'] = start_date.day end start_time = Time.parse(puppet_trigger['start_time']) trigger['start_hour'] = start_time.hour trigger['start_minute'] = start_time.min trigger end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 70 def trigger return @triggers if @triggers @triggers = [] task.trigger_count.times do |i| trigger = begin task.trigger(i) rescue Win32::TaskScheduler::Error => e # Win32::TaskScheduler can't handle all of the # trigger types Windows uses, so we need to skip the # unhandled types to prevent "puppet resource" from # blowing up. nil end next unless trigger and scheduler_trigger_types.include?(trigger['trigger_type']) puppet_trigger = {} case trigger['trigger_type'] when Win32::TaskScheduler::TASK_TIME_TRIGGER_DAILY puppet_trigger['schedule'] = 'daily' puppet_trigger['every'] = trigger['type']['days_interval'].to_s when Win32::TaskScheduler::TASK_TIME_TRIGGER_WEEKLY puppet_trigger['schedule'] = 'weekly' puppet_trigger['every'] = trigger['type']['weeks_interval'].to_s puppet_trigger['on'] = days_of_week_from_bitfield(trigger['type']['days_of_week']) when Win32::TaskScheduler::TASK_TIME_TRIGGER_MONTHLYDATE puppet_trigger['schedule'] = 'monthly' puppet_trigger['months'] = months_from_bitfield(trigger['type']['months']) puppet_trigger['on'] = days_from_bitfield(trigger['type']['days']) when Win32::TaskScheduler::TASK_TIME_TRIGGER_MONTHLYDOW puppet_trigger['schedule'] = 'monthly' puppet_trigger['months'] = months_from_bitfield(trigger['type']['months']) puppet_trigger['which_occurrence'] = occurrence_constant_to_name(trigger['type']['weeks']) puppet_trigger['day_of_week'] = days_of_week_from_bitfield(trigger['type']['days_of_week']) when Win32::TaskScheduler::TASK_TIME_TRIGGER_ONCE puppet_trigger['schedule'] = 'once' end puppet_trigger['start_date'] = self.class.normalized_date("#{trigger['start_year']}-#{trigger['start_month']}-#{trigger['start_day']}") puppet_trigger['start_time'] = self.class.normalized_time("#{trigger['start_hour']}:#{trigger['start_minute']}") puppet_trigger['enabled'] = trigger['flags'] & Win32::TaskScheduler::TASK_TRIGGER_FLAG_DISABLED == 0 puppet_trigger['index'] = i @triggers << puppet_trigger end @triggers = @triggers[0] if @triggers.length == 1 @triggers end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 167 def trigger=(value) desired_triggers = value.is_a?(Array) ? value : [value] current_triggers = trigger.is_a?(Array) ? trigger : [trigger] extra_triggers = [] desired_to_search = desired_triggers.dup current_triggers.each do |current| if found = desired_to_search.find {|desired| triggers_same?(current, desired)} desired_to_search.delete(found) else extra_triggers << current['index'] end end needed_triggers = [] current_to_search = current_triggers.dup desired_triggers.each do |desired| if found = current_to_search.find {|current| triggers_same?(current, desired)} current_to_search.delete(found) else needed_triggers << desired end end extra_triggers.reverse_each do |index| task.delete_trigger(index) end needed_triggers.each do |trigger_hash| # Even though this is an assignment, the API for # Win32::TaskScheduler ends up appending this trigger to the # list of triggers for the task, while #add_trigger is only able # to replace existing triggers. *shrug* task.trigger = translate_hash_to_trigger(trigger_hash) end end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 131 def trigger_insync?(current, should) should = [should] unless should.is_a?(Array) current = [current] unless current.is_a?(Array) return false unless current.length == should.length current_in_sync = current.all? do |c| should.any? {|s| triggers_same?(c, s)} end should_in_sync = should.all? do |s| current.any? {|c| triggers_same?(c,s)} end current_in_sync && should_in_sync end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 239 def triggers_same?(current_trigger, desired_trigger) return false unless current_trigger['schedule'] == desired_trigger['schedule'] return false if current_trigger.has_key?('enabled') && !current_trigger['enabled'] desired = desired_trigger.dup desired['every'] ||= current_trigger['every'] if current_trigger.has_key?('every') desired['months'] ||= current_trigger['months'] if current_trigger.has_key?('months') desired['on'] ||= current_trigger['on'] if current_trigger.has_key?('on') desired['day_of_week'] ||= current_trigger['day_of_week'] if current_trigger.has_key?('day_of_week') translate_hash_to_trigger(current_trigger) == translate_hash_to_trigger(desired) end
# File lib/puppet/face/node/clean.rb, line 150 def type_is_ensurable(resource) if (type = Puppet::Type.type(resource.restype)) && type.validattr?(:ensure) return true else type = environment.known_resource_types.find_definition('', resource.restype) return true if type && type.arguments.keys.include?('ensure') end return false end
Use either a specified command or the default for our provider.
# File lib/puppet/provider/service/service.rb, line 34 def ucommand(type, fof = true) if c = @resource[type] cmd = [c] else cmd = [send("#{type}cmd")].flatten end texecute(type, cmd, fof) end
# File lib/puppet/provider/user/windows_adsi.rb, line 81 def uid Puppet::Util::Windows::Security.name_to_sid(@resource[:name]) end
We use users and groups interchangeably, so use the same methods for both (the type expects different methods, so we have to oblige).
# File lib/puppet/provider/file/posix.rb, line 11 def uid2name(id) return id.to_s if id.is_a?(Symbol) or id.is_a?(String) return nil if id > Puppet[:maximum_uid].to_i begin user = Etc.getpwuid(id) rescue TypeError, ArgumentError return nil end if user.uid == "" return nil else return user.name end end
# File lib/puppet/provider/user/windows_adsi.rb, line 85 def uid=(value) fail "uid is read-only" end
# File lib/puppet/provider/service/upstart.rb, line 285 def unbalanced_parens_on(line) line.count('(') - line.count(')') end
# File lib/puppet/provider/service/upstart.rb, line 273 def uncomment(line) line.gsub(/^(\s*)#+/, '\1') end
# File lib/puppet/provider/service/upstart.rb, line 306 def uncomment_start_block_in(text) parens = 0 text.lines.map do |line| if line.match(COMMENTED_START_ON) || parens > 0 parens += unbalanced_parens_on(remove_trailing_comments_from_commented_line_of(line)) uncomment(line) else line end end.join('') end
# File lib/puppet/provider/zone/solaris.rb, line 306 def unconfigure zonecfg :delete, "-F" end
# File lib/puppet/face/node/clean.rb, line 118 def unexport(node) # fetch all exported resource query = {:include => {:param_values => :param_name}} query[:conditions] = [ "exported=? AND host_id=?", true, node.id ] Puppet::Rails::Resource.find(:all, query).each do |resource| if type_is_ensurable(resource) line = 0 param_name = Puppet::Rails::ParamName.find_or_create_by_name("ensure") if ensure_param = resource.param_values.find( :first, :conditions => [ 'param_name_id = ?', param_name.id ] ) line = ensure_param.line.to_i Puppet::Rails::ParamValue.delete(ensure_param.id); end # force ensure parameter to "absent" resource.param_values.create( :value => "absent", :line => line, :param_name => param_name ) Puppet.info("#{resource.name} has been marked as \"absent\"") end end end
# File lib/puppet/provider/package/dpkg.rb, line 144 def unhold Tempfile.open('puppet_dpkg_set_selection') do |tmpfile| tmpfile.write("#{@resource[:name]} install\n") tmpfile.flush execute([:dpkg, "--set-selections"], :failonfail => false, :combine => false, :stdinfile => tmpfile.path.to_s) end end
# File lib/puppet/provider/package/aix.rb, line 59 def uninstall # Automatically process dependencies when installing/uninstalling # with the -g option to installp. installp "-gu", @resource[:name] end
# File lib/puppet/provider/package/msi.rb, line 124 def uninstall_options join_options(resource[:uninstall_options]) end
Are we moving up the property tree?
# File lib/puppet/type/zone.rb, line 124 def up? self.class.fsm.cmp?(self.retrieve, self.should) end
# File lib/puppet/provider/package/aix.rb, line 125 def update self.install(false) end
# File lib/puppet/provider/service/upstart.rb, line 66 def upstart_version @upstart_version ||= initctl("--version").match(/initctl \(upstart ([^\)]*)\)/)[1] end
# File lib/puppet/network/formats.rb, line 35 def use_zlib? Puppet.features.zlib? && Puppet[:zlib] end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 64 def user account = task.account_information return 'system' if account == '' account end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 204 def user=(value) self.fail("Invalid user: #{value}") unless Puppet::Util::Windows::Security.name_to_sid(value) if value.to_s.downcase != 'system' task.set_account_information(value, resource[:password]) else # Win32::TaskScheduler treats a nil/empty username & password as # requesting the SYSTEM account. task.set_account_information(nil, nil) end end
# File lib/puppet/provider/user/user_role_add.rb, line 50 def user_attributes @user_attributes ||= UserAttr.get_attributes_by_name(@resource[:name]) end
Make sure we don’t purge users below a certain uid, if the check is enabled.
# File lib/puppet/type/resources.rb, line 116 def user_check(resource) return true unless self[:name] == "user" return true unless self[:unless_system_user] resource[:audit] = :uid return false if system_users.include?(resource[:name]) current_values = resource.retrieve_resource current_values[resource.property(:uid)] > self[:unless_system_user] end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 119 def user_insync?(current, should) return false unless current # Win32::TaskScheduler can return the 'SYSTEM' account as the # empty string. current = 'system' if current == '' # By comparing account SIDs we don't have to worry about case # sensitivity, or canonicalization of the account name. Puppet::Util::Windows::Security.name_to_sid(current) == Puppet::Util::Windows::Security.name_to_sid(should[0]) end
Force convert users it a list.
# File lib/puppet/provider/group/aix.rb, line 136 def users_from_attr(value) (value.is_a? String) ? value.split(',') : value end
##
Helper Methods ##
##
# File lib/puppet/provider/user/directoryservice.rb, line 476 def users_plist_dir '/var/db/dslocal/nodes/Default/users' end
# File lib/puppet/provider/file/windows.rb, line 83 def validate if [:owner, :group, :mode].any?{|p| resource[p]} and !supports_acl?(resource[:path]) resource.fail("Can only manage owner, group, and mode on filesystems that support Windows ACLs, such as NTFS") end end
Should we validate the checksum of the file we’re writing?
# File lib/puppet/type/file.rb, line 750 def validate_checksum? self[:checksum] !~ /time/ end
# File lib/puppet/type/zone.rb, line 326 def validate_exclusive(interface, address, router) return if !interface.nil? and address.nil? self.fail "only interface may be specified when using exclusive IP stack: #{interface}:#{address}" end
# File lib/puppet/reports/store.rb, line 67 def validate_host(host) if host =~ Regexp.union(/[#{SEPARATOR}]/, /\A\.\.?\Z/) raise ArgumentError, "Invalid node name #{host.inspect}" end end
# File lib/puppet/type/zone.rb, line 320 def validate_ip(ip, name) IPAddr.new(ip) if ip rescue ArgumentError self.fail "'#{ip}' is an invalid #{name}" end
# File lib/puppet/provider/package/msi.rb, line 116 def validate_source(value) fail("The source parameter cannot be empty when using the MSI provider.") if value.empty? end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 367 def validate_trigger(value) value = [value] unless value.is_a?(Array) # translate_hash_to_trigger handles the same validation that we # would be doing here at the individual trigger level. value.each {|t| translate_hash_to_trigger(t, true)} true end
# File lib/puppet/provider/exec/shell.rb, line 22 def validatecmd(command) true end
# File lib/puppet/provider/selboolean/getsetsebool.rb, line 7 def value self.debug "Retrieving value of selboolean #{@resource[:name]}" status = getsebool(@resource[:name]) if status =~ / off$/ return :off elsif status =~ / on$/ then return :on else status.chomp! raise Puppet::Error, "Invalid response '#{status}' returned from getsebool" end end
# File lib/puppet/provider/selboolean/getsetsebool.rb, line 22 def value=(new) persist = "" if @resource[:persistent] == :true self.debug "Enabling persistence" persist = "-P" end execoutput("#{command(:setsebool)} #{persist} #{@resource[:name]} #{new}") :file_changed end
# File lib/puppet/type/interface.rb, line 101 def value_to_s(value) value = [value] unless value.is_a?(Array) value.map{ |v| "#{v[1].to_s}/#{v[0]} #{v[2]}"}.join(",") end
Check that a group exists and is valid
# File lib/puppet/provider/user/aix.rb, line 167 def verify_group(value) if value.is_a? Integer or value.is_a? Fixnum groupname = self.groupname_by_id(value) raise ArgumentError, "AIX group must be a valid existing group" unless groupname else raise ArgumentError, "AIX group must be a valid existing group" unless groupid_by_name(value) groupname = value end groupname end
# File lib/puppet/provider/service/upstart.rb, line 169 def version_is_post_0_9_0 Puppet::Util::Package.versioncmp(upstart_version, "0.9.0") >= 0 end
# File lib/puppet/provider/service/upstart.rb, line 161 def version_is_pre_0_6_7 Puppet::Util::Package.versioncmp(upstart_version, "0.6.7") == -1 end
# File lib/puppet/provider/service/upstart.rb, line 165 def version_is_pre_0_9_0 Puppet::Util::Package.versioncmp(upstart_version, "0.9.0") == -1 end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 60 def working_dir task.working_directory end
# File lib/puppet/provider/scheduled_task/win32_taskscheduler.rb, line 155 def working_dir=(value) task.working_directory = value end
Write out the file. Requires the property name for logging. Write will be done by the content property, along with checksum computation
# File lib/puppet/type/file.rb, line 712 def write(property) remove_existing(:file) use_temporary_file = write_temporary_file? if use_temporary_file path = "#{self[:path]}.puppettmp_#{rand(10000)}" path = "#{self[:path]}.puppettmp_#{rand(10000)}" while ::File.exists?(path) or ::File.symlink?(path) else path = self[:path] end mode = self.should(:mode) # might be nil umask = mode ? 000 : 022 mode_int = mode ? symbolic_mode_to_int(mode, 0644) : nil content_checksum = Puppet::Util.withumask(umask) { ::File.open(path, 'wb', mode_int ) { |f| write_content(f) } } # And put our new file in place if use_temporary_file # This is only not true when our file is empty. begin fail_if_checksum_is_wrong(path, content_checksum) if validate_checksum? ::File.rename(path, self[:path]) rescue => detail fail "Could not rename temporary file #{path} to #{self[:path]}: #{detail}" ensure # Make sure the created file gets removed ::File.unlink(path) if FileTest.exists?(path) end end # make sure all of the modes are actually correct property_fix end
write the current content. Note that if there is no content property simply opening the file with ‘w’ as done in write is enough to truncate or write an empty length file.
# File lib/puppet/type/file.rb, line 765 def write_content(file) (content = property(:content)) && content.write(file) end
This method is only called on version 10.7 or greater. On 10.7 machines, passwords are set using a salted-SHA512 hash, and on 10.8 machines, passwords are set using PBKDF2. It’s possible to have users on 10.8 who have upgraded from 10.7 and thus have a salted-SHA512 password hash. If we encounter this, do what 10.8 does - remove that key and give them a 10.8-style PBKDF2 password.
# File lib/puppet/provider/user/directoryservice.rb, line 518 def write_password_to_users_plist(value) users_plist =<EMAIL_ADDRESS>shadow_hash_data = get_shadow_hash_data(users_plist) if self.class.get_os_version == '10.7' set_salted_sha512(users_plist, shadow_hash_data, value) else # It's possible that a user could exist on the system and NOT have # a ShadowHashData key (especially if the system was upgraded from 10.6). # In this case, a conditional check is needed to determine if the # shadow_hash_data variable is a Hash (it would be false if the key # didn't exist for this user on the system). If the shadow_hash_data # variable IS a Hash and contains the 'SALTED-SHA512' key (indicating an # older 10.7-style password hash), it will be deleted and a newer # 10.8-style (PBKDF2) password hash will be generated. if (shadow_hash_data.class == Hash) && (shadow_hash_data.has_key?('SALTED-SHA512')) shadow_hash_data.delete('SALTED-SHA512') end set_salted_pbkdf2(users_plist, shadow_hash_data, 'entropy', value) end end
# File lib/puppet/provider/service/upstart.rb, line 342 def write_script_to(file, text) Puppet::Util.replace_file(file, 0644) do |file| file.write(text) end end
# File lib/puppet/provider/user/directoryservice.rb, line 650 def write_sha1_hash(value) users_guid = self.class.get_attribute_from_dscl('Users', @resource.name, 'GeneratedUID')['dsAttrTypeStandard:GeneratedUID'][0] password_hash_file = "#{self.class.password_hash_dir}/#{users_guid}" write_to_file(password_hash_file, value) # NBK: For shadow hashes, the user AuthenticationAuthority must contain a value of # ";ShadowHash;". The LKDC in 10.5 makes this more interesting though as it # will dynamically generate ;Kerberosv5;;username@LKDC:SHA1 attributes if # missing. Thus we make sure we only set ;ShadowHash; if it is missing, and # we can do this with the merge command. This allows people to continue to # use other custom AuthenticationAuthority attributes without stomping on them. # # There is a potential problem here in that we're only doing this when setting # the password, and the attribute could get modified at other times while the # hash doesn't change and so this doesn't get called at all... but # without switching all the other attributes to merge instead of create I can't # see a simple enough solution for this that doesn't modify the user record # every single time. This should be a rather rare edge case. (famous last words) merge_attribute_with_dscl('Users', @resource.name, 'AuthenticationAuthority', ';ShadowHash;') end
# File lib/puppet/type/file.rb, line 771 def write_temporary_file? # unfortunately we don't know the source file size before fetching it # so let's assume the file won't be empty (c = property(:content) and c.length) || (s = @parameters[:source] and 1) end
This is a simple wrapper method for writing values to a file.
# File lib/puppet/provider/user/directoryservice.rb, line 642 def write_to_file(filename, value) begin File.open(filename, 'w') { |f| f.write(value)} rescue Errno::EACCES => detail raise Puppet::Error, "Could not write to file #{filename}: #{detail}" end end
This method will accept a plist in XML format, save it to disk, convert the plist to a binary format, and flush the dscl cache.
# File lib/puppet/provider/user/directoryservice.rb, line 636 def write_users_plist_to_disk(users_plist) Plist::Emit.save_plist(users_plist<EMAIL_ADDRESS>plutil'-convert', 'binary1'<EMAIL_ADDRESS>end
# File lib/puppet/util/zaml.rb, line 176 def yaml_property_munge(x) x end
If yaourt is installed, we can make use of it
# File lib/puppet/provider/package/pacman.rb, line 16 def yaourt? return File.exists? '/usr/bin/yaourt' end
# File lib/puppet/util/zaml.rb, line 179 def zamlized_class_name(root) cls = self.class "!ruby/#{root.name.downcase}#{cls == root ? '' : ":#{cls.respond_to?(:name) ? cls.name : cls}"}" end
# File lib/puppet/provider/zone/solaris.rb, line 346 def zoneadm(*cmd) adm("-z", @resource[:name], *cmd) rescue Puppet::ExecutionFailure => detail self.fail "Could not #{cmd[0]} zone: #{detail}" end
# File lib/puppet/provider/zone/solaris.rb, line 352 def zonecfg(*cmd) # You apparently can't get the configuration of the global zone (strictly in solaris11) return "" if self.name == "global" begin cfg("-z", self.name, *cmd) rescue Puppet::ExecutionFailure => detail self.fail "Could not #{cmd[0]} zone: #{detail}" end end
on zypper versions <1.0, the version option returns 1 some versions of zypper output on stderr
# File lib/puppet/provider/package/zypper.rb, line 12 def zypper_version cmd = [self.class.command(:zypper),"--version"] execute(cmd, { :failonfail => false, :combine => true}) end
Generated with the Darkfish Rdoc Generator 2.


Start your search here!
Search over 10,000 Power Tool Parts & Accessories.
{{> components/common/main-search-box}}--- products: new: limit: {{theme_settings.homepage_new_products_count}} featured: limit: {{theme_settings.homepage_featured_products_count}} top_sellers: limit: {{theme_settings.homepage_top_products_count}} carousel: {{theme_settings.homepage_show_carousel}} blog: recent_posts: limit: {{theme_settings.homepage_blog_posts_count}} --- {{#partial "page"}}
All orders over $25 ship for free.
Learn MoreSave tons by fixing your old tools.
Learn MoreOur experts are standing by to help.
Learn MorePower tool parts from Dewalt, Bostitch, Porter Cable & Black + Decker.


 I'm giving you an opportunity to decide for yourself what you want your life to become. I write what I know and know that what I write is me. I am 18 years old and, like most of my peers, I saw college as the freedom to party.
As long as there was something to drink, then there was something to drink about. Hangovers in class the next day didn't go over so well, and my beautiful MaryJane would have me wandering around campus not able to remember which class I had scheduled in the first place. Coke was around when the right people were around. The short-term effects had me disappointed and fiending, though, so I gave up on getting messed up. Then I got frostbite in September by Mr. Ice.
I was taking 19 hours at the time, so all the benefits got me through mid-terms great. A quarter of a gram (25 dollars worth) would get me through two nights of studying, two nights of partying, and two nights of no sleep easily. I was very pleased to see I was losing weight I didn't have in the first place. For some reason, it seemed to me that everything that came out of my mouth was the most profound statement in the history of mankind. I never realized that maybe I was running from something - something inside that your body hides deep within itself so you don't have to look.
I began to feel the weight of addiction heavy in my lungs when I started dating my dealer and dropped a half gram a day by myself.  I knew I had a problem when a guy knocked the pipe to the floor, and I had already started crying before it shattered. I began to get used to speedboats, (tinfoil folded in half - shiny side down! - and lit from the underside), and could feel my brain baking twice as much. I then began eating the stuff. I would hit almost a gram in one capsule and be up for days without any refills. My insides burned all the time and I thought I was getting a hole in my Liver. This was always my favorite way to get spun though. I was able to concentrate on one thing and work on it for hours on end. I'm naturally hyper, so Ice relaxes me. I was never big on cleaning the whole apartment in 10 minutes.
I began to hallucinate all the time, and at one point I lost sight of reality. I would wake up to the images of the nightmare I just had dancing on my ceiling. For a week, (and this is no joke) I would have sworn that Bin Laden was hiding in my closet - I kept seeing a white turban which was really a white sweater. I began making myself do something - anything - while high, (which was either when I was alone or with other people). So I found my beloved journal under my dorm bed. I figured it would at least keep me from giving myself a mental disorder.
It was amazing to think of the girl I used to be in those beginning pages. I almost felt nervous, like I was sneaking a look at somebody else's secrets and dreams. The ink turned from my usual loopy cursive to skinny lines, (vertical and horizontal) of smashed words flying all over the page. I had lost my gift. I had forgotten about all the passion I had for the world. Everything that forced my hand to write page after page about freedom, beauty, truth and life. I could only write about drugs. Once I spent 13 hours sitting in my car at the park doing nothing but writing. Ice made me focused, efficient, horny, mean, anxious, euphoric, anorexic, guilty, and so very shameful.
Shortly after, I found myself in a rehab outside Lubbock, TX. I never knew how sickening sober could feel. A month later I thought I could start my new life, since Ice had ruined the old one. The thought of snorting a bump, smoking a bohl, or sucking alumminum through a straw disgusted me - or so I thought.
Boys and Girls, hear me now: if you want drugs you will have to give your right arm to find them, and if you are trying to stay away from them - they will find you - EVERYTIME! I hit my rock bottom harder this time. I began to get mad at God for my being born an addict. I stopped praying, I stopped listening, and inevitably - I stopped caring.
I lost my apartment, my boyfriend, my car, and my respect in less than a month. I had no money for Ice so I started dancing at a local strip bar where I knew my drug house would be the dressing room - I was right.
Looking again like a Holocaust victim, I stared at myself in the mirror for 15 minutes trying with everything I had to see something I liked. When that didn't work I did what any decent young girl would do. I went on another binge. I was a shell, an empty shell filled with smoke. I tried to kill myself.
I woke up in a mental hospital. That very moment I opened my eyes I found a peace that was given to me from above, serenity from within, and some words I had forgotten months ago. There was a homeless man that always went to the same Alcoholics Annonymous meeting I did, and one day I told him that I hoped the worst was over. He said to me that you hit rock bottom when you stop digging. I threw down my shovel immediately.
Swinging my feet out of the bed, (and noticing the stitches on my wrist), I took what felt like the first step. Somehow, the tiny bit of dignity I had left had fought every dark corner of my soul and body while I slept - I guess it won.
I breathed a new breath, and I said a new prayer. It said: God, may my burdens always be too great to carry so I may be driven back to you for strength. That's all it took for me - a second chance to wake up.
Oh, and that 13-hour writing session in the park? I was able to decipher one poem I wrote. It's about Meth, it's about me, it's about truth. - Julianne - 7-29-2004
Methanpheta Cream Pie
The making of your soul -
i see the image of God
racing to reach my faltering heart
Will you have the battered shreds
of my corroded love?
Or will it rust the gleam from the
polished grace you swept
beneath my heart
Will you ripen the bruises i cannot cut
and piece whole my curse of glass?
My mind became an icy embrace
smoldering with
the seduction of betrayal
You made the light that ate
the shards of shadow
from the spark of your words
and the glow of your touch
that burns deeper than
desire dare reach
The thoughts pierce serrated claws
into my throat to slice the voice
that fingers your name with
broken nails pointing to wrists
gushing crystal waves of
crimson treason desperate
to divorce the mind
of free thought
i pine, i press, i gasp for the breath
of my bitter beauty that crackles
over the infected flesh of my
lungs who whore over every
frozen street to lick
the frost between the blocks
of jagged pavement
i collapse to the blindingly
impure rock of angel-white sin
to feed my frigid soul with the
combustion of shady snowflakes
torched on crinkled silver
over a flaccid flame of
fractured frustration
This whore bears not my name
Like a pathetic squatter in an
unwanted home, she sucks the barren
the moisture of my mind
then brings forth a torturous
aura of ravished despair that
crashes with craving to
display her humble
appreciation of services
granted by myself
The slave to the slut of sensation
The sleet blackens and my sight
of nothing grows dim
Now i fall
i scream
at nothing
and everything
for something
someone
The weight of my limbs are pulled
and the star-warmed
mercy of God
allows the blades to
release me as they fall
below to cut slices out
of the darkness
- Like Methanpheta Cream Pie
i feel the soft grip of a feather
as it beckons me to the surface
of my immortal sea of delusion
A beating of wings wraps me
in the arms of a dream
i lost in the folds of my soul
as i crippled beneath
His tears that fall with the rain.
3-12-2004
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


The Real Cybersecurity News: The Ukrainan Power Plant Attacks and Why You Should Care
Recent media coverage has been covering noise, but we need to focus on the signal
thoughts infosec cybersecurityRecently, there has been an overwhelming amount of discussion over WhatApp’s non-existent “Government backdoor”, which can easily be debunked with the following statement:
If Facebook wanted to allow any government to have a back door, they own the code base, they could just code one in. You wouldn’t know it. Additionally, the end points are still soft, you have to de-crypt the message to read it, which provides a much easier attack vector.
This is the result of a media outlet rolling with a story from a salty bug-bounty researcher and exciting an under-informed public over nothing important. At least Signal is getting some PR out of this. Good for Signal (which is a decent messaging app, it’s open source, secure but does have some hiccups, especially with late messages and attachments).
Furthermore, pushing this narrative urges people who need end-to-end encryption to move to a more convenient way of communication (because Signal isn’t widespread) which is often times SMS, a less than secure protocol. So while you may think it is important to encrypt your Friday night plans so big brother doesn’t know about your first world problems, others are at a much bigger risk.
The Real Cybersecurity News
In the meantime, the Ukraine has been hit with yet another cyber-attack disrupting their electric infrastructure. The first of which occurred in December 2015 through a sophisticated, multi-stage attack that consisted of custom firmware, spear-phishing e-mails, malicious Microsoft documents and telephone based denial of service attacks. The truly alarming part of this equation, besides the impressive amount of attack vectors used, is that the attackers performed reconnaissance of the network for an extended amount of time to properly understand the system, as these systems often times use propriety protocols or dated technology stacks. This is a major indicator that the attackers are disciplined and experienced.
The most recent attack was on a transmission station, and while there was a disruption of service, the damage could have been much worse according to initial reports. What this implies is that this particular attack was a demonstration or testing of a capability, not an actually attack for a desired strategic effect.
What this means:
You are probably saying to yourself, “I live in America (or Europe, or where ever), so this doesn’t matter to me”…. Except ICS/SCADA systems are designed very uniformly across the board. The main purpose behind these system is availability. They are designed to be uber-reliable and to provide the service at all times with high efficiency. Additionally, these systems are older, and at that time, security was the least of their developer’s concerns.
This can be observed by spending 10 minutes browsing shodan.io and seeing how many systems face the internet wide open.
So while there may be slight differences (models, protocols) between components like the Human Machine Interface (as the name states, the terminal for users) and Programmable Logic Controllers (components that do a specific action… i.e. open a valve) in California and in the Ukraine… they are still serving the same purpose.
 So while they are technically different, it wouldn’t take much effort on anyone’s part to understand how the other transcribes text to screen.
Lastly, with the growing concern of a “Cyber 911” occurring, this is a clear indicator of capability for a high valued effect. Although, judging by the amount of attention it is getting, no one really cares until it happens.
Further reading about the most current attack and the December 2015 attack.
Josh Stepp


Here are some of the things I consider essentials in my everyday life. While all of them may not realte to you some have personal meaning to me.


Package org.apache.guacamole.net.auth
Interface User
-
- All Superinterfaces:
Attributes
,Identifiable
,Permissions
,ReadableAttributes
- All Known Implementing Classes:
AbstractUser
,DelegatingUser
,SimpleUser
public interface User extends Identifiable, Attributes, Permissions
A user of the Guacamole web application.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
User.Attribute
All standard attribute names with semantics defined by the Guacamole web application.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description Permissions
getEffectivePermissions()
Returns a read-only view of all permissions granted to this user.default List<? extends ActivityRecord>
getHistory()
Deprecated.This function is deprecated in favor ofgetUserHistory()
, which returns the login history as an ActivityRecordSet which supports various sort and filter functions.Date
getLastActive()
Returns the date and time that this user was last active.String
getPassword()
Returns this user's password.RelatedObjectSet
getUserGroups()
Returns a set of all readable user groups of which this user is a member.default ActivityRecordSet<ActivityRecord>
getUserHistory()
Returns an ActivityRecordSet containing ActivityRecords representing the login history for this user, including any active sessions.void
setPassword(String password)
Sets this user's password.-
Methods inherited from interface org.apache.guacamole.net.auth.Attributes
setAttributes
-
Methods inherited from interface org.apache.guacamole.net.auth.Identifiable
getIdentifier, setIdentifier
-
Methods inherited from interface org.apache.guacamole.net.auth.Permissions
getActiveConnectionPermissions, getConnectionGroupPermissions, getConnectionPermissions, getSharingProfilePermissions, getSystemPermissions, getUserGroupPermissions, getUserPermissions
-
Methods inherited from interface org.apache.guacamole.net.auth.ReadableAttributes
getAttributes
-
-
-
-
Method Detail
-
getPassword
String getPassword()
Returns this user's password. Note that the password returned may be hashed or completely arbitrary.- Returns:
- A String which may (or may not) be the user's password.
-
setPassword
void setPassword(String password)
Sets this user's password. Note that while this function is guaranteed to change the password of this User object, there is no guarantee that getPassword() will return the value given to setPassword().- Parameters:
password
- The password to set.
-
getLastActive
Date getLastActive()
Returns the date and time that this user was last active. If the user was never active, the time that the user was last active is unknown, or this information is not visible to the current user, this may be null.- Returns:
- The date and time this user was last active, or null if this information is unavailable or inapplicable.
-
getHistory
@Deprecated default List<? extends ActivityRecord> getHistory() throws org.apache.guacamole.GuacamoleException
Deprecated.This function is deprecated in favor ofgetUserHistory()
, which returns the login history as an ActivityRecordSet which supports various sort and filter functions. While this continues to be defined for API compatibility, new implementation should avoid this function and use getUserHistory(), instead.Returns a list of ActivityRecords representing the login history of this user, including any active sessions. ActivityRecords in this list will be sorted in descending order of end time (active sessions are first), and then in descending order of start time (newer sessions are first). If user login history is not implemented this method should throw GuacamoleUnsupportedException.- Returns:
- A list of ActivityRecords representing the login history of this User.
- Throws:
org.apache.guacamole.GuacamoleException
- If history tracking is not implemented, if an error occurs while reading the history of this user, or if permission is denied.
-
getUserHistory
default ActivityRecordSet<ActivityRecord> getUserHistory() throws org.apache.guacamole.GuacamoleException
Returns an ActivityRecordSet containing ActivityRecords representing the login history for this user, including any active sessions. ActivityRecords in this list will be sorted in descending order of end time (active sessions are first), and then in descending order of start time (newer sessions are first). If login history tracking is not implemented, or is only implemented using the deprecatedgetHistory()
method, this method should throw GuacamoleUnsupportedException.- Returns:
- An ActivityRecordSet containing ActivityRecords representing the login history for this user.
- Throws:
org.apache.guacamole.GuacamoleException
- If history tracking is not implemented, if an error occurs while reading the history of this user, or if permission is denied.
-
getUserGroups
RelatedObjectSet getUserGroups() throws org.apache.guacamole.GuacamoleException
Returns a set of all readable user groups of which this user is a member. If permission is granted for the current user to modify the membership of this user, then the returned set will be mutable, and any such modifications should be made through changes to the returned set.- Returns:
- The set of all readable user groups of which this user is a member.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving the user groups.
-
getEffectivePermissions
Permissions getEffectivePermissions() throws org.apache.guacamole.GuacamoleException
Returns a read-only view of all permissions granted to this user. The exact semantics of what permissions are granted are up to the implementation, and the permissions within this view may be implied, derived dynamically, inherited through multiple levels of group membership, etc.- Returns:
- A read-only view of the permissions which are granted to this user.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving permissions, or if reading all permissions is not allowed.
-
-


pymatgen.analysis.ewald module¶
-
class
EwaldMinimizer
(matrix, m_list, num_to_return=1, algo=0)[source]¶ Bases:
object
This class determines the manipulations that will minimize an ewald matrix, given a list of possible manipulations. This class does not perform the manipulations on a structure, but will return the list of manipulations that should be done on one to produce the minimal structure. It returns the manipulations for the n lowest energy orderings. This class should be used to perform fractional species substitution or fractional species removal to produce a new structure. These manipulations create large numbers of candidate structures, and this class can be used to pick out those with the lowest ewald sum.
An alternative (possibly more intuitive) interface to this class is the order disordered structure transformation.
Author - Will Richards
Parameters: - matrix – A matrix of the ewald sum interaction energies. This is stored in the class as a diagonally symmetric array and so self._matrix will not be the same as the input matrix.
- m_list – list of manipulations. each item is of the form (multiplication fraction, number_of_indices, indices, species) These are sorted such that the first manipulation contains the most permutations. this is actually evaluated last in the recursion since I’m using pop.
- num_to_return – The minimizer will find the number_returned lowest energy structures. This is likely to return a number of duplicate structures so it may be necessary to overestimate and then remove the duplicates later. (duplicate checking in this process is extremely expensive)
-
ALGO_BEST_FIRST
= 2¶ Slowly increases the speed (with the cost of decreasing accuracy) as the minimizer runs. Attempts to limit the run time to approximately 30 minutes.
Type: ALGO_TIME_LIMIT
-
ALGO_COMPLETE
= 1¶
-
ALGO_FAST
= 0¶
-
ALGO_TIME_LIMIT
= 3¶
-
add_m_list
(matrix_sum, m_list)[source]¶ This adds an m_list to the output_lists and updates the current minimum if the list is full.
-
best_case
(matrix, m_list, indices_left)[source]¶ Computes a best case given a matrix and manipulation list.
Parameters: - matrix – the current matrix (with some permutations already performed)
- m_list – [(multiplication fraction, number_of_indices, indices, species)] describing the manipulation
- indices – Set of indices which haven’t had a permutation performed on them.
-
best_m_list
¶
-
get_next_index
(matrix, manipulation, indices_left)[source]¶ Returns an index that should have the most negative effect on the matrix sum
-
minimize_matrix
()[source]¶ This method finds and returns the permutations that produce the lowest ewald sum calls recursive function to iterate through permutations
-
minimized_sum
¶
-
output_lists
¶
-
class
EwaldSummation
(structure, real_space_cut=None, recip_space_cut=None, eta=None, acc_factor=12.0, w=0.7071067811865475, compute_forces=False)[source]¶ Bases:
object
Calculates the electrostatic energy of a periodic array of charges using the Ewald technique. Ref: http://www.ee.duke.edu/~ayt/ewaldpaper/ewaldpaper.html
This matrix can be used to do fast calculations of ewald sums after species removal.
E = E_recip + E_real + E_point
Atomic units used in the code, then converted to eV.
Initializes and calculates the Ewald sum. Default convergence parameters have been specified, but you can override them if you wish.
Parameters: - structure (Structure) – Input structure that must have proper Specie on all sites, i.e. Element with oxidation state. Use Structure.add_oxidation_state… for example.
- real_space_cut (float) – Real space cutoff radius dictating how many terms are used in the real space sum. Defaults to None, which means determine automagically using the formula given in gulp 3.1 documentation.
- recip_space_cut (float) – Reciprocal space cutoff radius. Defaults to None, which means determine automagically using the formula given in gulp 3.1 documentation.
- eta (float) – The screening parameter. Defaults to None, which means determine automatically.
- acc_factor (float) – No. of significant figures each sum is converged to.
- w (float) – Weight parameter, w, has been included that represents the relative computational expense of calculating a term in real and reciprocal space. Default of 0.7 reproduces result similar to GULP 4.2. This has little effect on the total energy, but may influence speed of computation in large systems. Note that this parameter is used only when the cutoffs are set to None.
- compute_forces (bool) – Whether to compute forces. False by default since it is usually not needed.
-
CONV_FACT
= 14.399645351950547¶
-
compute_partial_energy
(removed_indices)[source]¶ Gives total ewald energy for certain sites being removed, i.e. zeroed out.
-
compute_sub_structure
(sub_structure, tol=0.001)[source]¶ Gives total ewald energy for an sub structure in the same lattice. The sub_structure must be a subset of the original structure, with possible different charges.
Parameters: - substructure (Structure) – Substructure to compute Ewald sum for.
- tol (float) – Tolerance for site matching in fractional coordinates.
Returns: Ewald sum of substructure.
-
eta
¶
-
forces
¶ The forces on each site as a Nx3 matrix. Each row corresponds to a site.
-
get_site_energy
(site_index)[source]¶ Compute the energy for a single site in the structure
Parameters: site_index (int) – Index of site Returns: (float) - Energy of that site
-
point_energy
¶ The point energy.
-
point_energy_matrix
¶ The point space matrix. A diagonal matrix with the point terms for each site in the diagonal elements.
-
real_space_energy
¶ The real space space energy.
-
real_space_energy_matrix
¶ The real space energy matrix. Each matrix element (i, j) corresponds to the interaction energy between site i and site j in real space.
-
reciprocal_space_energy
¶ The reciprocal space energy.
-
reciprocal_space_energy_matrix
¶ The reciprocal space energy matrix. Each matrix element (i, j) corresponds to the interaction energy between site i and site j in reciprocal space.
-
total_energy
¶ The total energy.
-
total_energy_matrix
¶ The total energy matrix. Each matrix element (i, j) corresponds to the total interaction energy between site i and site j.
Note that this does not include the charged-cell energy, which is only important when the simulation cell is not charge balanced.


?<3>ª
AGED
NEW
YORK
BOTANICAL
GARDEN
0291
iCE*
Yoi^
BOTANICAL
GARDEN
HERBARIUM
No.
Agricultural
Experiment.Station
University
of
Puerto
Rico
_5
a.
p
oti
a
c
e.
&-&
11
P
È
I
*vnrv&
mr\
n\~V\
0\Q
Va
R.I1C.
Collected
by
fl.
\A/nn
Locality
U/p
n
C
Determined
by>fl
U/n
n
<4
Ir.
?
i
v
^
^a'j^vwn-w
Date
:
cV,-^e>
2_t,
195q
Observations
01029115
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


| date | location | type | pred_new_infected_mean | pred_new_infected_per_mil | probability_infected | |
|---|---|---|---|---|---|---|
| 0 | 2020-10-07 | North Dakota | usstate | 2536.00 | 3327.81 | 4.85 |
| 1 | 2020-10-07 | South Dakota | usstate | 2528.00 | 2857.60 | 4.05 |
| 2 | 2020-10-07 | Arkansas | usstate | 7444.00 | 2466.69 | 3.39 |
| 3 | 2020-10-07 | Missouri | usstate | 14784.00 | 2408.83 | 3.11 |
| 4 | 2020-10-07 | Wisconsin | usstate | 13046.00 | 2240.64 | 2.93 |
| 5 | 2020-10-07 | Miami-Dade County, FL | uscounty | 5353.00 | 1970.23 | 2.84 |
| 6 | 2020-10-07 | Tennessee | usstate | 10984.00 | 1608.39 | 2.38 |
| 7 | 2020-10-07 | Iowa | usstate | 5238.00 | 1660.19 | 2.31 |
| 8 | 2020-10-07 | Montana | usstate | 1791.00 | 1675.75 | 2.12 |
| 9 | 2020-10-07 | Kansas | usstate | 4226.00 | 1450.58 | 2.00 |
| 10 | 2020-10-07 | Oklahoma | usstate | 5726.00 | 1447.07 | 1.93 |
| 11 | 2020-10-07 | Nebraska | usstate | 2807.00 | 1451.09 | 1.88 |
| 12 | 2020-10-07 | Dallas County, TX | uscounty | 3443.00 | 1306.39 | 1.83 |
| 13 | 2020-10-07 | Harris County, TX | uscounty | 6030.00 | 1279.35 | 1.79 |
| 14 | 2020-10-07 | Palm Beach County, FL | uscounty | 1960.00 | 1309.49 | 1.79 |
| 15 | 2020-10-07 | Broward County, FL | uscounty | 2424.00 | 1241.31 | 1.78 |
| 16 | 2020-10-07 | Bexar County, TX | uscounty | 2380.00 | 1187.89 | 1.74 |
| 17 | 2020-10-07 | North Carolina | usstate | 12700.00 | 1210.90 | 1.73 |
| 18 | 2020-10-07 | Tarrant County, TX | uscounty | 2592.00 | 1232.81 | 1.72 |
| 19 | 2020-10-07 | Clark County, NV | uscounty | 2485.00 | 1096.30 | 1.61 |
| 20 | 2020-10-07 | Florida | usstate | 23595.00 | 1098.58 | 1.58 |
| 21 | 2020-10-07 | Idaho | usstate | 1969.00 | 1101.81 | 1.58 |
| 22 | 2020-10-07 | Orange County, FL | uscounty | 1493.00 | 1071.44 | 1.52 |
| 23 | 2020-10-07 | Alabama | usstate | 5163.00 | 1052.99 | 1.51 |
| 24 | 2020-10-07 | South Carolina | usstate | 5241.00 | 1017.92 | 1.50 |
| 25 | 2020-10-07 | Hillsborough County, FL | uscounty | 1590.00 | 1080.19 | 1.50 |
| 26 | 2020-10-07 | Texas | usstate | 28540.00 | 984.28 | 1.47 |
| 27 | 2020-10-07 | Minnesota | usstate | 6312.00 | 1119.22 | 1.46 |
| 28 | 2020-10-07 | Alameda County, CA | uscounty | 1748.00 | 1045.87 | 1.45 |
| 29 | 2020-10-07 | San Bernardino County, CA | uscounty | 2061.00 | 945.38 | 1.42 |
| 30 | 2020-10-07 | Kentucky | usstate | 4507.00 | 1008.80 | 1.41 |
| 31 | 2020-10-07 | Indiana | usstate | 7068.00 | 1049.88 | 1.38 |
| 32 | 2020-10-07 | Alaska | usstate | 805.00 | 1100.41 | 1.35 |
| 33 | 2020-10-07 | Mississippi | usstate | 2518.00 | 846.06 | 1.34 |
| 34 | 2020-10-07 | Sacramento County, CA | uscounty | 1377.00 | 887.21 | 1.31 |
| 35 | 2020-10-07 | Orange County, CA | uscounty | 2698.00 | 849.58 | 1.22 |
| 36 | 2020-10-07 | Washoe County, NV | uscounty | 439.00 | 931.03 | 1.22 |
| 37 | 2020-10-07 | West Virginia | usstate | 1522.00 | 849.26 | 1.19 |
| 38 | 2020-10-07 | Georgia | usstate | 7816.00 | 736.15 | 1.15 |
| 39 | 2020-10-07 | Wyoming | usstate | 516.00 | 891.56 | 1.11 |
| 40 | 2020-10-07 | Louisiana | usstate | 3364.00 | 723.63 | 1.10 |
| 41 | 2020-10-07 | Virginia | usstate | 6574.00 | 770.19 | 1.08 |
| 42 | 2020-10-07 | Nevada | usstate | 2230.00 | 723.99 | 1.07 |
| 43 | 2020-10-07 | Utah | usstate | 2469.00 | 770.13 | 1.05 |
| 44 | 2020-10-07 | Delaware | usstate | 718.00 | 737.34 | 1.03 |
| 45 | 2020-10-07 | Ohio | usstate | 8690.00 | 743.43 | 1.02 |
| 46 | 2020-10-07 | Rhode Island | usstate | 717.00 | 676.82 | 0.99 |
| 47 | 2020-10-07 | Santa Clara County, CA | uscounty | 1398.00 | 725.16 | 0.97 |
| 48 | 2020-10-07 | Maricopa County, AZ | uscounty | 2964.00 | 660.81 | 0.97 |
| 49 | 2020-10-07 | Riverside County, CA | uscounty | 1562.00 | 632.25 | 0.96 |
| 50 | 2020-10-07 | Illinois | usstate | 8664.00 | 683.72 | 0.96 |
| 51 | 2020-10-07 | Hawaii | usstate | 898.00 | 634.24 | 0.93 |
| 52 | 2020-10-07 | Philadelphia County, PA | uscounty | 1093.00 | 690.00 | 0.90 |
| 53 | 2020-10-07 | New Mexico | usstate | 1245.00 | 593.75 | 0.83 |
| 54 | 2020-10-07 | Pennsylvania | usstate | 8164.00 | 637.71 | 0.82 |
| 55 | 2020-10-07 | Cook County, IL | uscounty | 2903.00 | 563.66 | 0.76 |
| 56 | 2020-10-07 | Maryland | usstate | 3175.00 | 525.17 | 0.75 |
| 57 | 2020-10-07 | Suffolk County, MA | uscounty | 456.00 | 567.23 | 0.74 |
| 58 | 2020-10-07 | Washington | usstate | 4054.00 | 532.38 | 0.73 |
| 59 | 2020-10-07 | Middlesex County, MA | uscounty | 892.00 | 553.45 | 0.73 |
| 60 | 2020-10-07 | California | usstate | 18919.00 | 478.81 | 0.72 |
| 61 | 2020-10-07 | Los Angeles County, CA | uscounty | 4600.00 | 458.21 | 0.70 |
| 62 | 2020-10-07 | Arizona | usstate | 3421.00 | 470.00 | 0.69 |
| 63 | 2020-10-07 | Oregon | usstate | 2008.00 | 476.08 | 0.66 |
| 64 | 2020-10-07 | District of Columbia | usstate | 339.00 | 480.34 | 0.65 |
| 65 | 2020-10-07 | Massachusetts | usstate | 3255.00 | 472.25 | 0.64 |
| 66 | 2020-10-07 | San Diego County, CA | uscounty | 1454.00 | 435.55 | 0.63 |
| 67 | 2020-10-07 | Wayne County, MI | uscounty | 712.00 | 407.01 | 0.54 |
| 68 | 2020-10-07 | Michigan | usstate | 3877.00 | 388.21 | 0.54 |
| 69 | 2020-10-07 | Colorado | usstate | 2307.00 | 400.61 | 0.53 |
| 70 | 2020-10-07 | Hudson County, NJ | uscounty | 266.00 | 395.60 | 0.49 |
| 71 | 2020-10-07 | New York City County, NY | uscounty | 2971.00 | 339.69 | 0.42 |
| 72 | 2020-10-07 | Connecticut | usstate | 1147.00 | 321.71 | 0.40 |
| 73 | 2020-10-07 | New York | usstate | 5913.00 | 303.95 | 0.39 |
| 74 | 2020-10-07 | Essex County, NJ | uscounty | 235.00 | 294.13 | 0.37 |
| 75 | 2020-10-07 | New Jersey | usstate | 2508.00 | 282.36 | 0.36 |
| 76 | 2020-10-07 | King County, WA | uscounty | 620.00 | 275.22 | 0.35 |
| 77 | 2020-10-07 | Suffolk County, NY | uscounty | 377.00 | 255.32 | 0.32 |
| 78 | 2020-10-07 | Bergen County, NJ | uscounty | 230.00 | 246.73 | 0.32 |
| 79 | 2020-10-07 | Westchester County, NY | uscounty | 237.00 | 244.96 | 0.31 |
| 80 | 2020-10-07 | Nassau County, NY | uscounty | 229.00 | 168.76 | 0.21 |
| 81 | 2020-10-07 | Maine | usstate | 218.00 | 162.18 | 0.20 |
| 82 | 2020-10-07 | New Hampshire | usstate | 199.00 | 146.35 | 0.18 |
| 83 | 2020-10-07 | Vermont | usstate | 17.00 | 27.24 | 0.04 |


The Gillian Debugger#
The Gillian debugger provides a custom interface for visualising symbolic execution and unification, via a bespoke VSCode extension.
Danger
The debugger is still in development; expect bugs, missing features, and breaking changes!
Feel free to report any issues or feature requests.
Setup#
The debugger is used via a custom VSCode extension, found under the debugger-vscode-extension/
directory in the repo.
To try out the debugger, follow these steps:
Make sure Gillian is built (see Installation)
cd into
debugger-vscode-extension/
Run
yarn
to set up dependenciesRun
yarn build
to build the extension (oryarn watch
to rebuild automatically)In the Run and debug tab of VSCode, make sure Debugger Extension is selected from the dropdown, and click the green play button to start the extension
A new VSCode window should open in
debugger-vscode-extension/sampleWorkspace/
, with the extension installedIn this window, open the workspace settings, and under the Extensions > Gillian Debugger section:
Set Run mode to
installed
Set Source directory to
${workspaceFolder}/../../
If you want to disable automatic folding and unfolding of predicates, check Use manual proof
A Guided Tour#
Let’s take it for a spin! Open list_length_rec.wisl
, and click Debug llen to start the debugger.
Note
Make sure you aren’t running any esy
processes (e.g. esy watch
), as this may prevent the debugger from starting.
You should then be presented with a new panel showing the path of execution in a graph. Here you can see the current command in the highlighted node, and two subsequent commands yet to be executed.
In the left-hand panel, you can see the current state of symbolic execution.
Each section of the state represents:
Store: The values of program variables
Memory: Memory assertions, e.g. the contents of the heap
Pure Formulae: Pure (i.e. first-order logic) formulae
Typing Environment: Variable types
Predicates: Any known predicates
Tip
Take care to remember that the Memory section may not tell the full story of the heap; some information may be ‘hidden’ in the definitions of Predicates.
Click on the play button under the true branch to execute the next command (in the true case of the if-else). Notice how our Pure Formulae have updated to show that we now know #x
is null
.
Now, click the target button on the first command to ‘jump’ back to it. Gillian stores the full trace of execution, so you can jump back and forth, and across branches, as you please.
With the first command selected, click the Continue button in the standard debugger controls to fully execute the rest of the program. You should see execution complete with no errors, and all unifications succeeding - lucky us!
You’ll know a unification has occurred when a Unify badge appears on the command node. In this case, the function is returning, so Gillian has unified with the post-condition. Let’s take a closer look; when a command with a unification is selected, click the UNIFICATION tab at the top to look into the unification process.
In unification, Gillian attempts to match the state against a sequence of assertions (called a unification plan). Click the target button on one of the assertions to see what’s been learned so far.
If unification has failed, the offending assertion will be highligted in red.
Caution
As of the time of writing, the debugger has only been tested with wisl - you’re free to try other target languages, but do so at your own peril!
Technical Details#
The Gillian debugger started life as a strict follower of the Debug Adapter Protocol. However, the DAP was designed with concrete execution in mind, thus proving too restrictive for the non-linearity of symbolic execution. However, the exensibility of the DAP, together with the power of VSCode extensions, allowed us to transcend these restrictions with a custom interface (while, unfortunately, sacrificing near free-of-charge cross-IDE support).
The Gillian debugger’s “stack” consists of:
The Webview is the custom interface, built as a React single-page-app. It is built separately from, and ‘embedded’ into, the VSCode extension, using VSCode’s provided message passing API to communicate with the extension (and by extension, Gillian).
The Extension acts as a middleman of sorts; it tells VSCode how to run Gillian in debug mode, initialises a debugger session, and passes messages between Gillian and the webview.
Gillian is the core of the debugger; it performs the actual symbolic execution and unification. It uses custom events and commands alongside the provided DAP ones to bidirectionally communicate with the extension.
Credit goes to the authors of React Flow, the library responsible for core parts of the debugger interface.


LE SAMOURAI A film review by James Berardinelli Copyright 1997 James Berardinelli
RATING (0 TO 10): 9.0 Alternative Scale: **** out of ****
France/Italy, 1967 U.S. Re-release Date: Spring 1997 (limited) Running Length: 1:45 MPAA Classification: Not Rated (Violence, mature themes) Theatrical Aspect Ratio: 1.66:1
Cast: Alain Delon, Francois Perier, Nathalie Delon, Cathy Rosier, Jacques Leroy Director: Jean-Pierre Melville Producers: Raymond Borderie, Eugene Lepicier Screenplay: Jean-Pierre Melville based on the novel THE RONIN by Joan McLeod Cinematography: Henri Decae Music: Francois De Roubaix U.S. Distributor: Artificial Eye In French with subtitles
There can be many reasons for re-releasing a motion picture. In some cases, like STAR WARS, the motive is as much for profit as it is for artistic reasons. The same claim cannot be made of LE SAMOURAI, a 1967 thriller that has been cited by no less an authority than internationally-acclaimed director John Woo as a nearly perfect movie. LE SAMOURAI will not rake in money at the box office during this, its thirtieth anniversary re-release, but it will give a small legion of North American movie-goers an opportunity to see this landmark film uncut and in its full glory.
Woo is right -- LE SAMOURAI is close to perfection. It combines stylish direction, an intelligent script, first-rate performances, and overpowering atmosphere into one of the most tense and absorbing thrillers ever to reach the screen. In trying to identify a film with a similar impact, I'm left grasping at thin air -- nothing quite like it exists in the annals of motion picture history, even when considering the work of Alfred Hitchcock. However, watching LE SAMOURAI makes it obvious that directors like Quentin Tarantino and Brian DePalma are familiar with this particular entry on Jean-Pierre Melville's resume. Its influence upon their work is evident.
LE SAMOURAI is developed like a chess game between two equally- intelligent, determined opponents. One, Jeff Costello (Alain Delon, of PURPLE NOON), is an expert hit-man whose deeds are untraceable and whose alibis are unbreakable. The other is a police superintendent (Francois Perier) who is sure that Costello is responsible for a recent murder. He believes that, with dogged persistence, he can catch someone in a lie or uncover some discrepancy in his suspect's story. As the movie progresses and an apparent checkmate draws closer, the level of tension in LE SAMOURAI reaches an almost-unbearable level. One standout sequence has Costello attempting to evade an intricate trap that the superintendant has set for him in the Paris Metro.
LE SAMOURAI opens with a quote from "The Book of Bushido" (a fictional creation of writer/director Melville): "There is no solitude greater than a samurai's, unless perhaps it is that of a tiger in the jungle." The film then proceeds to illustrate how this truth applies to the protagonist. Alain Delon's performance is subtle and mesmerizing. His expression never changes, but his eyes, his bearing, and the occasional trickle of sweat speak volumes. Delon has an undeniable screen presence -- when the camera focuses on him, we cannot help but look.
The first thing that strikes the viewer about LE SAMOURAI is likely to be the aspect of the film that leaves the most lasting impression: its incredible sense of style. This is a black-and-white noir film photographed in color, with gloomy exteriors and dim interiors. It's always raining or cloudy, and the most prominent color is gray. Even when a room is brightly lit, the source of illumination is inevitably harsh fluorescents that leech the color from everything. Visually, LE SAMOURAI is arresting, but the movie's stylistic preeminence doesn't stop there. Melville draws us into the cold, cruel world of his protagonist by presenting lengthy stretches in which there is no dialogue. The film opens with ten minutes of speech-free scenes, followed by a short verbal interchange, then two more minutes without dialogue, another brief conversation, three additional minutes without talking, and so forth... Melville does not clutter up his film with needless chatter, and, as a result, when someone speaks in LE SAMOURAI, we listen.
Delon is supported by a fine cast. Francois Perier plays the superintendent as a canny policeman who will do whatever it takes to get his man -- he can be charming or nasty, as circumstances demand. Delon's real life wife (at the time), Nathalie, who plays Costello's lover and alibi, is every bit as sexy as Catherine Deneuve. And Cathie Rosier portrays Valerie as the perfect mix of the enigmatic and the alluring. She's one of the mysteries that Costello must solve if he's going to outfox the cops.
If you're a fan of film noir in particular or thrillers in general, you owe it to yourself to seek out a copy of LE SAMOURAI (it should be released on video after its limited theatrical run). Despite its absence on many critics "best of" lists, this motion picture deserves a place at the pinnacle of the genre. As John Woo indicated, it's difficult to imagine a much more accomplished film.
- James Berardinelli e-mail<EMAIL_ADDRESS>ReelViews web site: http://www.cybernex.net/~berardin
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Homepage - The new world!
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
Blog - The future of the life
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
About page
Hello, this is a page created by nhannt201. This page is a product use to learn Javascript, Css, and HTML.
Please record the source if you want to copy it.


Make sure to run the full test suite, or there will be quite a few broken images here. Run this from the top-level pial directory:
PYTHONPATH=. nosetests -s tests/


Nunggubuyu Grammar Online |
Nunggubuyu is a non-Pama-Nyungan language of Australia, spoken around Numbulwar in Eastern Arnhem Land.
The ISO 693-3 code for the language is nuy; alternate names for the language are Nunggubuju, Wubuy and Yingkwira.
These pages present Jeffrey Heath's description of the language, originally published in three separate volumes, as a web resource.


All Classes
Actionable
AudioPlayer
AudioPlayerExample
BaseController
DatabaseProvider
Employee
EmployeeController
Item
ItemType
Main
MonitorType
MoviePlayer
MoviePlayerExample
MultimediaControl
ProduceController
Product
Production
ProductionLogController
ProductionWithProduct
ProductLineController
RootController
Screen
ScreenExample
ScreenSpec
SuppressFBWarnings
UpdateRequestedEvent
Util
Widget


Syntax:
write-string string &optional output-stream &key start end => string
write-line string &optional output-stream &key start end => string
Arguments and Values:
string---a string.
output-stream -- an output stream designator. The default is standard output.
start, end---bounding index designators of string. The defaults for start and end are 0 and nil, respectively.
Description:
write-string writes the characters of the subsequence of string bounded by start and end to output-stream. write-line does the same thing, but then outputs a newline afterwards.
Examples:
(prog1 (write-string "books" nil :end 4) (write-string "worms")) >> bookworms => "books" (progn (write-char #\*) (write-line "test12" *standard-output* :end 5) (write-line "*test2") (write-char #\*) nil) >> *test1 >> *test2 >> * => NIL
Side Effects: None.
Affected By:
*standard-output*, *terminal-io*.
Exceptional Situations: None.
See Also:
Notes:
write-line and write-string return string, not the substring bounded by start and end.
(write-string string) == (dotimes (i (length string) (write-char (char string i))) (write-line string) == (prog1 (write-string string) (terpri))


{% extends "base.html" %} {% comment %} Logout page Author: Jonathan Karr<EMAIL_ADDRESS>Affiliation: Covert Lab, Department of Bioengineering, Stanford University Created: 2014-03-25 {% endcomment %} {% block content %}
Thank you for using WholeCellDB!


Leviticus 11:26
The carcasses of every beast which divideth the hoof, and is not cloven-footed, nor cheweth the cud, are unclean unto you: every one that toucheth them shall be unclean.


CrimPapers
Articles published on 15 July 2019
On 15 July 2019, 5 new articles were published in 5 journals.
Revisiting the Role of Distributive Justice in Tyler’s Legitimacy Theory
‘the Resurrection After the Old Has Gone and the New Has Come’: Understanding Narratives of Forgiveness, Redemption and Resurrection in Christian Individuals Serving Time in Custody For A Sexual Offence by Nicholas Blagden, Belinda Winder, Rebecca Lievesley
Compliance Improvement Review by HM Government
The New-Far-Right Movement in Australia by Jade Hutchinson
Intimate Partner Violence and Material Hardship Among Urban Mothers by Julia O’connor, Lenna Nepomnyaschy


Type stuff in the inputs below and watch for messages in the console.
Simple event subscription via Y.on
Non-adaptive delay subscription from Node instance (400ms delay)
Configured subscription, fires shortly after a mention of a dog


Apply for help with health costs
The Low Income Scheme
If you find it difficult to pay for health costs you may be entitled to some help towards the cost of:
- NHS Prescriptions;
- NHS Dental treatment;
- NHS wigs and fabric supports;
- sight tests, glasses and contact lenses;
- travel to receive NHS treatment if referred by a doctor (GP or hospital doctor), dentist or optician
You can apply at any time. Do not wait until you need treatment.
You cannot get help with health costs if you or your partner (or both) have more than:
- £16,000 in savings, investments or properties (not counting the place where you live); or
- £23,250 in savings, investments or properties if you permanently live in a care home
You may already be entitled to help with health costs if you are:
- getting income support
- getting pension credit guarantee credit
- getting universal credit
- named on, or entitled to, an NHS Tax Credit Exemption certificate
What to do if the above applies to you
You can claim for:
- yourself;
- your partner; or
- your children;