Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Allow alarms to specify entity_label as well. #24

Merged
merged 2 commits into from about 1 year ago

2 participants

Dave King Phil Kates
Dave King
Owner

No description provided.

Dave King
Owner

Needed to do this for the same reason as the previous branch too (entity id is not set on the node).

Sorry about the false start, will be more careful in testing in the future.

Phil Kates
Owner
philk commented March 22, 2013

Yup, looks good here too. +1

Dave King tildedave merged commit a2d0320 into from March 22, 2013
Dave King tildedave closed this March 22, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  metadata.rb
@@ -3,7 +3,7 @@
3 3
 license          "Apache 2.0"
4 4
 description      "Installs/Configures Rackspace Cloud Monitoring"
5 5
 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6  
-version          "0.2.2"
  6
+version          "0.2.3"
7 7
 
8 8
 depends "python"
9 9
 
8  providers/alarm.rb
@@ -47,7 +47,13 @@
47 47
 
48 48
 
49 49
 def load_current_resource
50  
-  @entity = get_entity_by_id @new_resource.entity_id || node['cloud_monitoring']['entity_id']
  50
+  if @new_resource.entity_label then
  51
+    raise Exception, "Cannot specify entity_label and entity_id" unless @new_resource.entity_id.nil?
  52
+    @entity = get_entity_by_label @new_resource.entity_label
  53
+  else
  54
+    @entity = get_entity_by_id @new_resource.entity_id || node['cloud_monitoring']['entity_id']
  55
+  end
  56
+
51 57
   @current_resource = get_alarm_by_id @entity.id, node['cloud_monitoring']['alarms'][@new_resource.label]
52 58
   if @current_resource == nil then
53 59
     @current_resource = get_alarm_by_label @entity.id, @new_resource.label
1  resources/alarm.rb
@@ -7,6 +7,7 @@
7 7
 attribute :criteria, :kind_of => String
8 8
 attribute :notification_plan_id, :kind_of => String
9 9
 attribute :entity_id, :kind_of => String
  10
+attribute :entity_label, :kind_of => String
10 11
 
11 12
 attribute :example_id, :kind_of => String
12 13
 attribute :example_values, :kind_of => Hash
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.