mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[cloudstack|security_group] fix rule revoke mock
This commit is contained in:
parent
8e3ee75555
commit
c47ba29b39
5 changed files with 11 additions and 10 deletions
|
@ -7,8 +7,8 @@ module Fog
|
|||
|
||||
attribute :security_group_id, :type => :string
|
||||
attribute :protocol, :type => :string
|
||||
attribute :start_port, :type => :integer
|
||||
attribute :end_port, :type => :integer
|
||||
attribute :start_port, :type => :integer, :aliases => 'startport'
|
||||
attribute :end_port, :type => :integer, :aliases => 'endport'
|
||||
attribute :cidr, :type => :string
|
||||
attribute :direction, :type => :string
|
||||
|
||||
|
@ -19,6 +19,10 @@ module Fog
|
|||
job.successful?
|
||||
end
|
||||
|
||||
def port_range
|
||||
(self.start_port..self.end_port)
|
||||
end
|
||||
|
||||
def save
|
||||
requires :security_group_id, :cidr, :direction
|
||||
|
||||
|
@ -36,6 +40,7 @@ module Fog
|
|||
|
||||
def reload
|
||||
requires :id, :security_group_id, :cidr
|
||||
|
||||
merge_attributes(security_group.rules.get(self.id))
|
||||
end
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ module Fog
|
|||
}
|
||||
|
||||
self.data[:jobs][job_id]= job
|
||||
self.data[:security_groups][security_group_id] = security_group
|
||||
|
||||
{ "authorizesecuritygroupegressresponse" => { "jobid" => job_id } }
|
||||
end
|
||||
|
|
|
@ -62,7 +62,6 @@ module Fog
|
|||
}
|
||||
|
||||
self.data[:jobs][job_id]= job
|
||||
self.data[:security_groups][security_group_id] = security_group
|
||||
|
||||
{ "authorizesecuritygroupingressresponse" => { "jobid" => job_id } }
|
||||
end
|
||||
|
|
|
@ -16,8 +16,8 @@ module Fog
|
|||
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter id')
|
||||
end
|
||||
|
||||
security_group_id, security_group = self.data[:security_groups].find do |id,group|
|
||||
group['egressrule'] && group['egressrule'].delete_if { |r| r['id'] == security_group_rule_id }
|
||||
security_group = self.data[:security_groups].values.find do |group|
|
||||
(rule = (group['egressrule'] || []).find{|r| r['ruleid'] == security_group_rule_id}) && group['egressrule'].delete(rule)
|
||||
end
|
||||
|
||||
job_id = Fog::Cloudstack.uuid
|
||||
|
@ -33,7 +33,6 @@ module Fog
|
|||
}
|
||||
|
||||
self.data[:jobs][job_id]= job
|
||||
self.data[:security_groups][security_group_id] = security_group
|
||||
|
||||
{"revokesecuritygroupegress" => { "jobid" => job_id }}
|
||||
end
|
||||
|
|
|
@ -19,8 +19,8 @@ module Fog
|
|||
raise Fog::Compute::Cloudstack::BadRequest.new('Unable to execute API command missing parameter id')
|
||||
end
|
||||
|
||||
security_group_id, security_group = self.data[:security_groups].find do |id,group|
|
||||
group['ingressrule'] && group['ingressrule'].delete_if { |r| r['id'] == security_group_rule_id }
|
||||
security_group = self.data[:security_groups].values.find do |group|
|
||||
(rule = (group['ingressrule'] || []).find{|r| r['ruleid'] == security_group_rule_id}) && group['ingressrule'].delete(rule)
|
||||
end
|
||||
|
||||
job_id = Fog::Cloudstack.uuid
|
||||
|
@ -36,7 +36,6 @@ module Fog
|
|||
}
|
||||
|
||||
self.data[:jobs][job_id]= job
|
||||
self.data[:security_groups][security_group_id] = security_group
|
||||
|
||||
{"revokesecuritygroupingress" => { "jobid" => job_id }}
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue