Displaying 20 results from an estimated 31 matches for "to_hash".
2012 Dec 14
11
Puppet and Mcollective yaml file changing when it shouldn't
...xtra space. It
appears to add a couple different entries each run.
Here is the file resource --
"/var/tmp/facts.yaml":
owner => root,
group => root,
mode => 400,
loglevel => debug,
content => inline_template("<%= scope.to_hash.reject { |k,v| k.to_s
=~ /(uptime_seconds|uptime_hours|timestamp|free)/ }.to_yaml %>")
Any thoughts or suggestions? Seems like an odd one to me.
-Z
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on t...
2011 Nov 04
2
problem with templates
...se and it keeps
having problems with anything other than <%= var %> type definitions.
I even went as far cutting and pasting from the puppet online
documentation just to see if it were maybe something I goofed. I
pasted below the tested template and the error that I get with it.
<% scope.to_hash.keys.each do |k| -%>
<%= k %>
<% end -%>
err: compile error
(erb):2: syntax error, unexpected $end, expecting kEND
_erbout
^
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to pup...
2012 Jul 05
1
hash to_yaml in erb template not giving valid yaml
...r some reason it won''t provide a valid yaml format if I
dump my scope to hash and convert to_yaml.
file {
"/etc/mcollective/facts.yaml" :
owner => root,
group => root,
mode => 400,
loglevel => debug,
#content => inline_template("<%= scope.to_hash.reject { |k,v| !(
k.is_a?(String) && v.is_a?(String) ) }.to_yaml %>"),
#content => inline_template("<%= { \"a\" => 1, \"b\"=> 2}.to_yaml %>"),
content =>
inline_template("<%= facts = {}; scope.to_hash.each_pair {|k,v|...
2008 Jan 08
1
odd facter error with split
...`value''
from /usr/lib/ruby/site_ruby/1.8/facter.rb:355:in `value''
from /usr/lib/ruby/site_ruby/1.8/facter.rb:352:in `each''
from /usr/lib/ruby/site_ruby/1.8/facter.rb:352:in `value''
from /usr/lib/ruby/site_ruby/1.8/facter.rb:189:in `to_hash''
from /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/inflector.rb:250:in
`inject''
from /usr/lib/ruby/site_ruby/1.8/facter.rb:187:in `each''
from /usr/lib/ruby/site_ruby/1.8/facter.rb:187:in `inject''
from /usr/lib...
2006 Jul 06
4
Need advice on code-like columns
Hello!
I''m trying to move to rails from traditional web app.
As Rails has some conventions about table schema,
I met some obstacles.
Questions.
1.
This is a sort of general question. Do you make a code table for things
like the following?
Activity Status Codes
01001: Open
01002: Pending
01003: Delayed
01004: Cancelled
01005: Closed
(The first 2 digits are code category.)
Would you
2012 Dec 03
4
Unnecessary changes when creating facts.yaml
I have set up puppet to create a facts.yaml file for mcollective using the
following line:
content => inline_template("<%= scope.to_hash.reject { |k,v| k.to_s =~
/(uptime.*|timestamp|.*free|macaddress.*|ipaddress)/ }.to_yaml %>"),
However, it is creating a lot of unnecessary changes by reordering the
facts in the yaml output as you can see in the diff output between to runs;
--- facts.yaml 2012-12-03 10:25:15.389570751 +...
2007 Jul 24
11
Mock or Stub strategy for validates_uniqueness_of
Hi,
I''m a bit stuck with mocking a unit test of a join model with regards to a
validates_uniqueness_of clause.
I have
class Book < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clip < AR:B
has_many :clippings
various validates_presence_of etc
end
class Clipping < AR:B
belongs_to :book
belongs_to :clip
validates_uniqueness_of :clip_id,
2007 Dec 10
10
Reading Hash/Array
Hi all,
My app is generating a form with several bill_items that should be
updated (fields to be updated are description and net).
The text_field_tag names are bill_item[update][#{id}][description] and
bill_item[update][#{id}][net] (and I added bill_item[update][#{id}]
[id] just in case)
The param received is:
{"commit"=>"Save",
2011 Feb 02
11
How to include the Scope(...) in a generated string?
I''d like to include similar information that notice() spits out in a
file I am generating -- basically so that anyone looking at the
generated file (actually a file fragment) could trace it back to the
class that is generating the entry.
Using $name within the file fragment is the closest I am getting to
what I want -- is there anything better?
--
You received this message because you
2007 Mar 02
1
example standalone error.
...sample app :)''
key = MiddleMan.new_worker(:class => :example_worker)
worker = MiddleMan.worker(key)
worker.other_method
worker.delete
# now that my job is done (and my worker is actually deleted on the server)
view
# my results ... cause now I''lm interested.
p worker.results.to_hash
puts ''bye bye :)''
I kinda confused because most of the examples online and in /examples assume
that one is using Rails for this. Its kind of difficult to see exactly
where require or init calls need to go.
regards,
David G.
-------------- next part --------------
An HTML attach...
2006 Oct 30
3
Question about new results hash
Is it really a hash? As in, can I pass it into a method that a worker is
calling so that, for example, a method in my ActiveRecord that''s
actually doing the work?
Really liking the new code. Does rubyforge or devjavu have the rdocs
anywhere?
--
Joshua Warchol
Code Poet, Zaadz Inc.
http://joshua.zaadz.com/
2009 Apr 24
4
uninitialized constant Facter::IPAddress (NameError)
...;'
from /usr/lib/ruby/site_ruby/1.8/facter/util/loader.rb:30:in `each''
from /usr/lib/ruby/site_ruby/1.8/facter/util/loader.rb:30:in `load_all''
from /usr/lib/ruby/site_ruby/1.8/facter/util/collection.rb:90:in
`load_all''
from /usr/lib/ruby/site_ruby/1.8/facter.rb:91:in `to_hash''
from /usr/bin/facter:125
My facter version is 1.5.4.
--
Michael Conigliaro
Computer Analyst
Fuss & O''Neill Technologies
www.fandotech.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups &quo...
2012 Jun 01
3
Serialized attribute saved as HashWithIndifferentAccess in database
My Booking model has: serialize :custom_data, Hash
From the console it works as expected saving values to the custom_data
attribute.
But when having a form with parameters like
this: booking[custom_data][hello] and creating a new object in the
controller like this: Booking.new( params[:booking] ), values are saved in
the database with added metadata like this: ---
2010 Apr 08
3
Puppet commands giving nothing but a stack trace
...er/util/fact.rb:71:in `each''
... 16 levels...
from /usr/lib/ruby/site_ruby/1.8/facter/util/loader.rb:30:in `load_all''
from /usr/lib/ruby/site_ruby/1.8/facter/util/collection.rb:90:in `load_all''
from /usr/lib/ruby/site_ruby/1.8/facter.rb:91:in `to_hash''
from /usr/bin/facter:138
Ruby itself seems to run:
# ruby --version
ruby 1.8.5 (2006-08-25) [x86_64-linux]
But that''s not much of a challenge and I don''t know how to do anything more complicated. Perhaps there''s some boring Ruby one-liner I cou...
2006 Nov 04
0
arrayfields-3.6.0
...- store
- values
3.3.0:
- added gemspec file - thnx Assaph Mehr
- added FieldedArray proxy class which minimizes modifications to class
Array and allow ArrayFields to work (potientially) other arraylike object.
thnks Sean O''Dell
- added ArrayFields#to_hash method - this seems like an obvious one to add!
- remedied bug where using append feature of assigning with unknow field
appedended but did not append to acutal fields
- added samples
- created rubyforge accnt @ http://rubyforge.org/projects/arrayfields/
3.2.0:
- prec...
2006 Oct 02
1
Problems Deploying a Camping app on TxD
...39;ve been trying all day to get a small camping app I wrote up on
Textdrive to no avail.
Right now I''m getting a 500 error when I go to the site, and it spits this
out (from lightty after i restart it and make a request to the app):
(eval):13:in `initialize'': undefined method `to_hash'' for
#<FCGI::Stream:0x83a35d8> (NoMethodError)
from (eval):44:in `run''
from /users/home/me/web/app/app.rb:227
from /users/home/me/web/app/app.rb:225
...the line in the app that it''s referring to (225) is in the postamble, the
FCGI part:
if...
2007 Jan 10
0
LazyDoc over DRb
...reason DRb doesn''t like it and won''t return the "hash" to the
remote client.
I tried using index[''example_doc_id''].load.to_a, and the array gets
returned just fine. For the record, yes, I''ve tried
index[''example_doc_id''].load.to_hash, but what you get from that is
again a Ferret::Index::LazyDoc, and not a Hash.
I suppose I could manually copy the elements from LazyDoc to a new
Hash, but that''s hacky. Before I resort to it, does anyone have any
ideas?
Thanks in advance.
--
Julio C. Ody
http://rootshell.be/~julioody
2012 Aug 07
0
spatial_adapter and ruby_ldap
...object_class})" +
"(#{user_login_attribute}=#{login}))"
Comp::Directory::LdapServer.as_anonymous do | conn |
puts conn.perror("bind")
conn.search(userbase, LDAP::LDAP_SCOPE_SUBTREE, filter) do |e|
users << LdapUser.new(e.to_hash)
end
puts conn.perror("search")
end
end
Rails reports error "failed to allocate memory" but running free -m -s1 in
another window does not indicate memory loss.
Running rails console with the following code works successfully:
conn = LDAP::Conn.new(&...
2006 Nov 16
1
Assigning to results - missing something
Hi,
I''m trying to convert an app to use 0.2.0, and having a little trouble
understanding how to use the results hash.
Formerly my worker had an instance variable, @file_stats which was
initialized to an empty hash; I have replaced @file_stats with
results[:file_hash]. Actually my initial pass at this was just to do a
s/@file_stats/results[:file_hash]/. Which gets me the following:
2007 Apr 19
0
scRUBYt! 0.2.8
...ownload pattern: download the file pointed to by the
parent pattern
[NEW] checking checkboxes
[NEW] basic authentication support
[NEW] default values for missing elements (basic version)
[NEW] possibility to resolve relative paths against a custom url
[NEW] first simple version of to_csv and to_hash
[NEW] complete rewrite of the exporting system (Credit: Neelance)
[NEW] first version of smart regular expressions: they are constructed
from examples, just as regular expressions (Credit: Neelance)
[NEW] Possibility to click the n-th link
[FIX] Clicking on links using scRUBYt''s adv...