Displaying 20 results from an estimated 97 matches for "has_key".
2010 Oct 25
0
[PATCH node] add network.py script
...ID=""
+ self.VL_ROOT=""
+ self.VL_FILENAME =""
+ self.nic=""
+ self.bridge=""
+ self.vlan_id=""
+
+ def configure_interface(self):
+ log("Configuring Interface")
+ if OVIRT_VARS.has_key("OVIRT_IP_ADDRESS"):
+ IPADDR = OVIRT_VARS["OVIRT_IP_ADDRESS"]
+ NETMASK = OVIRT_VARS["OVIRT_IP_NETMASK"]
+ GATEWAY = OVIRT_VARS["OVIRT_IP_GATEWAY"]
+ PREFIX = OVIRT_VARS["OVIRT_IP_PREFIX"]
+
+ if O...
2011 Jul 18
0
[PATCH] fix ipv6 switch to disabled
...network.py
+++ b/scripts/network.py
@@ -78,7 +78,6 @@ class Network:
self.BR_CONFIG += "set %s/TYPE Bridge\n" % BR_ROOT
self.BR_CONFIG += "set %s/PEERNTP yes\n" % BR_ROOT
self.BR_CONFIG += "set %s/DELAY 0\n" % BR_ROOT
-
if OVIRT_VARS.has_key("OVIRT_IPV6"):
if OVIRT_VARS["OVIRT_IPV6"] == "auto":
self.BR_CONFIG += "set %s/IPV6INIT yes\n" % BR_ROOT
@@ -89,11 +88,16 @@ class Network:
self.BR_CONFIG += "set %s/IPV6_AUTOCONF no\n" % BR_ROOT...
2011 Jul 20
0
[PATCH] fix ipv4 static/dhcp/disabled networking changes
...it a/scripts/network.py b/scripts/network.py
index 8159283..8956d00 100644
--- a/scripts/network.py
+++ b/scripts/network.py
@@ -42,27 +42,21 @@ class Network:
def configure_interface(self):
log("Configuring Interface")
+ self.disabled_nic = 0
if OVIRT_VARS.has_key("OVIRT_IP_ADDRESS"):
IPADDR = OVIRT_VARS["OVIRT_IP_ADDRESS"]
NETMASK = OVIRT_VARS["OVIRT_IP_NETMASK"]
GATEWAY = OVIRT_VARS["OVIRT_IP_GATEWAY"]
- if OVIRT_VARS.has_key("OVIRT_BOOTIF"):
- self...
2006 Aug 24
3
A new QueueWorker class
Hello all,
I''ve come up w/ a worker class that manages queued jobs using a fixed
number of child workers. Well, that''s not quite true -- a new worker is
spawned for each job, but you set the total number that may exist at once.
There are three components:
1) queue_worker.rb: The singleton worker that manages the child workers.
You probably want to auto start this. Make sure you
2010 Oct 26
0
[PATCH node] add install.py
...t.read()
+ disk = disk.rstrip(disk[-1:])
+ length = len(disk) - 1
+ partN = disk[length:]
+ partN = int(partN) - 1
+ disk = disk.rstrip(disk[-1:])
+
+ if disk is None and partN < 0:
+ log("unable to determine Root partition")
+ sys.exit(1)
+ if OVIRT_VARS.has_key("OVIRT_ISCSI_ENABLED") and OVIRT_VARS["OVIRT_ISCSI_ENABLED"] != "y":
+ mount_liveos()
+ if not os.path.ismount("/liveos"):
+ log("Root partition not available")
+ sys.exit(1)
+
+ # prepare Root partition update...
2009 Oct 06
1
[PATCH] Fix refreshing vms list This patch fix vms index view when a smart pool is not destroyed correctly.
...8..9afc354 100644
--- a/app/models/smart_pool.rb
+++ b/app/models/smart_pool.rb
@@ -62,18 +62,16 @@ class SmartPool < Pool
if nested_pools
nested_pools.each do |pool_element|
pool = pool_element[:obj]
- if pool.hasChildren
+ if pool.hasChildren and pool_element.has_key?(:children)
if pool.name == user
pool_element[:children].each do |child_element|
child_pool = child_element[:obj]
user_pools <<[child_pool.name, child_pool.id]
end
else
- if pool_element.has_key?(:childre...
2013 Jan 06
1
[PATCH] menugen: Make it compatible with Py3k
...;Error before line %d" % self.lineno)
+ print("REASON: menu must be declared before a menu item is declared")
sys.exit(1)
self.menus[-1][1].append(self.entry)
self.init_entry()
def set_item(self,name,value):
- if not self.entry.has_key(name):
+ if name not in self.entry:
msg = ["Unknown attribute %s in line %d" % (name,self.lineno)]
msg.append("REASON: Attribute must be one of %s" % self.vattrs)
return "\n".join(msg)
- if name=="type" and not sel...
2006 Mar 16
3
Passing function names from string variables
...9;'m trying to figure out if there is a way to pass in the string
value of a variable as the name of a method.
For example, I would like to do something like:
def sort_obj_by_uid(objects,@attr)
@tmparray = Array.new
@tmphash = Hash.new
for object in @objects
if ! @tmphash.has_key?(object.@attr.to_s)
@tmphash[object.@attr.to_s] = Array.new
end
@tmphash[object.@attr.to_s].push(object)
end
end
Where the method name is the @attr value.
--
Leah Cunningham : d416-585-9971x692 : d416-703-5977 : m416-559-6511
Frauerpower! Co. : www.frauerpower.com : Tor...
2007 Mar 04
1
using AR outside of rails
...ds on. It''s also well suited to be used from other various
applications though. The simplest way I could think of to make my
application work inside and outside of rails without much user
intervention would be something like this.
require ''activerecord''
if ENV and ENV.has_key?(''RAILS_ENV'')
require ''models/mymodel''
ActiveRecord::Base.establish_connection()
end
I''d probably use a yaml file to store the database configuration like
rails does.
Any better ideas?
--~--~---------~--~----~------------~-------~--~----~
You rece...
2009 Jan 03
2
Some questions from a new webgen user
...e
some thing like {menu: {class: important}} for the important pages. Is
there a way to do this?
- let''s say i have a sidebar that i want to populate on some pages. I
can do this using a block sidebar on theses page and having this on my
template:
<% if node.node_info[:page].blocks.has_key?(''sidebar'') %>
<webgen:block name=''sidebar'' />
<% end %>
(this is taken from the faq).
However, if i use a special template in a new directory: foo/
default.template, the root template /default.template will not find
the block sidebar in...
2007 Feb 28
6
DRY question - image_tag :alt and :title the same
Hello,
I have the following:
image_tag(''show.png'', :alt => ''show article'', :title => ''show
article'', :border => 0)
Is it possible that I donĀ“t need to have "=> ''show article''" twice in
this row? e.g. something similar to this pseudo code: (:alt, :title)
=> ''show article''.
2010 Oct 28
5
[PATCH] Fix pci passthru in xend interface used by libvirt
...39;' in pci_dev_info:
pci_dev_info[''opts''] = pci_opts_list_from_sxp(pci_dev)
- # append uuid to each pci device that does''t already have one.
+ # If necessary, initialize uuid, key, and vdevfn for each pci device
if not pci_dev_info.has_key(''uuid''):
- dpci_uuid = pci_dev_info.get(''uuid'', uuid.createString())
- pci_dev_info[''uuid''] = dpci_uuid
+ pci_dev_info[''uuid''] = uuid.createString()
+ if not pci_dev_info.has_key('...
2006 Aug 03
5
Store common settings in one file?
Hi,
I''m looking for a way to store common settings, such as the
application_name or email address from value in a file.
I then want to be able to call these settings in my controllers and
models?
Is there any easy way of doing this? and where would you recommend I
save the file ?
Thanks
scott
--
Posted via http://www.ruby-forum.com/.
2010 Mar 22
2
ActiveMerchant, Authorize.net and Email Receipts
...chase, Authorize.net was still
not sending receipts. I investigated further, and found this in the
ActiveMerchant code:
BEGIN RUBY
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class AuthorizeNetGateway < Gateway
...snip...
def add_customer_data(post, options)
if options.has_key? :email
post[:email] = options[:email]
post[:email_customer] = false
end
if options.has_key? :customer
post[:cust_id] = options[:customer]
end
if options.has_key? :ip
post[:customer_ip] = options[:ip]
end
end
.....
2006 Feb 06
9
tests fine, but fail under rake
..., 0 failures, 0 errors
However when I run rake I get this:
2) Error:
test_search(StoryCommentsControllerTest):
ActionView::TemplateError: Couldn''t find Story without an ID AND (status
= ''approved'')
On line #2 of app/views/story_comments/list.rhtml
1: <%unless params.has_key?(:search_terms)%>
2: <%= render_component(:controller => ''stories'', :action => ''show'',:id
=> params[:id], :params=>{:context=>''small''})%>
3: <%else%>
Now the weird thing is, it that this line 2 of list.rhtml shoul...
2006 May 10
0
Ezra''s acl_system2 and flash not getting populated in functional tests
...est_redirect_not_admin
assert not_admin = User.authenticate("not_admin", "her_password")
ACTIONS.each do |a|
get a, {}, { :user => route_admin }, nil
assert_redirected_to :controller => "account", :action => "login"
#assert flash.has_key?(:message), "No flash after action #{a}"
#assert_equal "You must log in as an administrator.", flash
[:message]
end
end
The flash assertions work only for the first action. In the example
above the assert flash.has_key?(:message) test fails on the second
action :ne...
2006 Feb 28
0
ActiveRecord: Legacy primary keys
...9;
end
Base Class:
class UserPKActiveRecord < ActiveRecord::Base
def self.inherited(sub)
set_table_name undecorated_table_name(sub)
self.class_eval <<-EOS
def initialize params = nil
super
self.id = params[self.class.primary_key] if params &&
params.has_key?(self.class.primary_key)
end
EOS
end
def self.set_primary_key pk
super
alias_method pk, :id
alias_method pk + ''='', :id=
self.class_eval <<-EOS
def #{pk}_before_type_cast
return read_attribute(self.class.primary_key) if
read_att...
2004 May 03
1
Install of 3.1 aborts
...to install on a machne which isn't supported by this
release of CentOS-3
The error message stems from this part of anaconda code in
packages.py:
# this is a crappy hack, but I don't want bug reports from these people
if (iutil.getArch() == "i386") and (not grpset.hdrlist.has_key("kernel")):
intf.messageWindow(_("Error"),
_("You are trying to install on a machine "
"which isn't supported by this release of "
"%s.") %(productName,...
2010 Oct 26
0
[PATCH node] add collectd.py
...log("Failed to write $collectd_conf")
+ sys.exit(1)
+
+ os.system("chkconfig collectd on")
+ os.system("service collectd restart")
+
+# AUTO for auto-install
+if len(sys.argv) > 1:
+ if sys.argv[1] == "AUTO":
+ if not OVIRT_VARS.has_key("OVIRT_COLLECTD_SERVER") or not OVIRT_VARS.has_key["OVIRT_COLLECTD_PORT"]:
+ log("\nAttempting to locate remote collectd server...")
+ host, port = find_srv("collectd", "udp")
+ if not host is None and not port is No...
2010 Oct 26
0
[PATCH node] add logging.py
...rsyslog_config = open(RSYSLOG_FILE, "w")
+ rsyslog_config.write(rsyslog_config_out)
+ rsyslog_config.close()
+ os.system("/sbin/service rsyslog restart")
+
+if len(sys.argv) > 1:
+ try:
+ if sys.argv[1] == "AUTO":
+ if not OVIRT_VARS.has_key("OVIRT_SYSLOG_SERVER") or not OVIRT_VARS.has_key("OVIRT_SYSLOG_PORT"):
+
+ log("\nAttempting to locate remote syslog server...")
+ host, port = find_srv("syslog", "udp")
+ if not host is N...