Displaying 20 results from an estimated 900 matches similar to: "hash to_yaml in erb template not giving valid yaml"
2012 Dec 14
11
Puppet and Mcollective yaml file changing when it shouldn't
Has anyone else ran into this?
debug: /Stage[main]/Mcollective/File[/var/tmp/facts.yaml]/content:
Executing ''diff -u /var/tmp/facts.yaml
/tmp/puppet-file20121214-13448-933j3r-0''
notice: /Stage[main]/Mcollective/File[/var/tmp/facts.yaml]/content:
--- /var/tmp/facts.yaml 2012-12-14 00:53:20.000000000 +0000
+++ /tmp/puppet-file20121214-13448-933j3r-0 2012-12-14
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
2010 Jul 17
1
not able to find to_yaml definition
I am looking at rails edge source code.
I am able to do
puts User.find.to_yaml
However I am not able to find piece of code where ''def to_yaml'' is.
How this to_yaml serialization is working?
can fully understand how to_json and to_xml is working but to_yaml
beats me.
Thanks
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2011 Mar 31
5
Exclude a resource from reports
A little while back I asked how to make puppet not report on a
resource.. and was shown the loglevel metaparam:
Quoting bellman@nsc.liu.se:
There is a metaparameter called ''loglevel''. If you set that
to something lower than "notice" (i.e. either "info" or "debug"),
then Puppet won''t report that it applied the resource...
So I made my
2006 Jun 23
0
to_yaml problem with option hash
Hi,
I''m trying to make a fixture for testing with a serialized column. In
the YAML fixture I''m trying to fill the serialized column with the
to_yaml function. But I keep getting the ''---'' separator, which I don''t
want because it is only a ''partial'' yaml fill.
According to the documentation to_yaml takes a hash of options, so
2007 Oct 07
1
How to store a Mechanize object in the database?
Hi,
I am trying to save a Mechanize object in database (using a Rails Model).
But the save operation throws a TypeError
Considering that "agent" is an instance of a Rails Model and "user" is
defined as a "text" type in the Model.
irb(main):039:0> agent.user = WWW::Mechanize.new
#<WWW::Mechanize:0xb71295f0 @follow_meta_refresh=false, @key=nil,
2006 Jan 11
0
Limit attributes written out by to_yaml
I want to write out a series of records to a text file so that I can
quickly edit them and then upload then again into the database. To do
this I am using YAML and some code that looks like this:
item = Item.find 153
File.open( ''item.yaml'', ''w'' ) do |out|
YAML.dump( item, out )
end
This dumps out all the field names and values which are stored in the
2009 Jun 30
6
Variable named "memory" in templates
I tried to use a Puppet variable named "$memory" and access it from
a template, like this:
$memory = 4711
file {
"/tmp/test.txt":
content => inline_template("memory = <%= memory %>\n");
}
One would think that my file would contain "memory = 4711" after that,
but instead the memory variable seems to hold a
2010 Dec 17
1
flash[;notice] not display after redirection
I read all previous posts about the same subject in Devise group but
couldn''t find any answer, so iy may not be related to Devise , so
I debugged it ..
.
class Users::RegistrationsController <
Devise::RegistrationsController
..
# POST /resource/sign_up
def create
build_resource
if resource.save
if resource.active?
set_flash_message :notice, :signed_up
2008 Mar 10
2
response.body == filename?
I''m using RSpec.
describe UserController do
it "should require ..." do
post :login, {:name => ''root''}
puts response.body.to_yaml
end
end
....--- user/login
?????
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this
2009 Nov 10
10
Un-recognised routes that do exist, using namespaces & subdomain checking
I''m getting really cheesed off with RSpec not matching some of my
routes when controller testing when I have subdomain checking
(courtesy of subdomain-fu) on namespaces. These routes appear in the
rake routes output, and work fine via HTTP requests .
The really annoying thing is it''s working fine for routes that aren''t
at the root of the namespace.
E.g. say I have
2007 Mar 29
1
Extending the to_s method
Hi!
I''m developing an localization plugin (just for my own purposes) and I
wanted to extend the to_s method for the Time class.
What I want to do:
when someone does date.to_s(:short) that a localized version of
the :short date is displayed.
But I don''t know how to accomplish this. I know have this:
class Time
def to_s(option)
print option.to_yaml
2007 May 29
1
YAML fails when has_one is null
My model has_one :association
If I call model.to_yaml (or y model) in the console, and the
association is nil, I get a yaml error. Anyone else get this? Is
this a confirmed bug?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2008 Apr 16
2
Question about yaml. Thank you !!
Hi friends:
I tried to convert a model object to yaml(use to_yaml method), and after
that, I would like to convert the yaml(string type) back to the model
object. But when I use YAML::load to do that, it failed, the return
object''s class is Yaml class, not my prior model class.. Please tell me
how can I do to convert yaml to an object as the prior model class, or
how can I access the
2013 Oct 28
1
inline_template private method `gets' called for false:FalseClass
Hi,
I am new to Ruby ERB and inline_template. Can anyone spot what''s wrong
with this inline_template?
$moddedContent = inline_template("<%= puts gets(nil).gsub(/one
two three/,\"\") /tmp/blah %>")
exec {
"/bin/echo ''${moddedContent}'' > /tmp/blah" :
}
When I try to apply it, I
2012 Mar 27
1
Arrays from templates
Hi,
I am having an issue trying to use the inline_template function to
return an array. This is what I do:
$array = inline_template ("<%= a=[''a1'',''b2'',''c3'']; a %>")
notify {"array: ${array}":}
And that works, showing the typical comma-less string:
notice: /Stage[main]//Notify[array: a1b2c3]/message: defined
2007 Jun 27
3
acts_as_tree and before_save
We all know that acts_as_tree gives us ability to set up data in a
tree-like structure and use methods like ''parent'', ''children'' and so on.
Something I''m completely stuck on. Observe.
class Page < ActiveRecord::Base
acts_as_tree
def before_save
raise self.parent.to_yaml
end
end
Well, you''d think that it should show
2011 Mar 29
0
Issue / code smell in AssociationProxy
I came across an issue in my code and after a hard debug session I
found something that smells.
First the context of my issue. I have a AR object that has a
polymorphic belongs_to currently tied to nothing, I want to dump it to
YAML.
record.to_yaml
This raises the following exception:
TypeError: wrong argument type nil (expected Data)
from
2011 Nov 04
2
problem with templates
I am having an issue with templates that I cant quite figure out why
it is having an issue.
I am using ruby dsl to read a template from a database 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
2011 Oct 25
7
additional model attributes
Hi,
i have a "place" model with 2 columns (id, name).
I''m calling an external api which gives me data to create a new place
object.
I would like to add the address from the external place to the place
object and render it as a json result, without storing it in the
database.
i don''t get any errors, but the address never shows up within the json
output. i''ve