Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Complete the Recipes Section of Docs #68

Open
icebourg opened this Issue · 4 comments

3 participants

@icebourg

We've got a pretty significant deploy of collins going, and it's been a great tool. We've started to get to the point where we really want to start expanding collins via callbacks, and have a tentative idea for what we want to do, but the docs are kind of sparse. The recipes section doesn't have anything listed.

I think the best thing to document first would be the list of replacement variables that are available like the doc for the provision script does. One example <tag>, but are there others? For example, when asset_meta_value_create is called, is there a variable that tells us which value was created?

Without a replacement like that, we'll have to get the logs for that tag and operate anything we find there, but it would be nice to know if we have to do that, or if collins will give us the exact values for free if you just know how to ask. :)

I tried looking through the code but I'm not familiar enough with scala to be able to piece out the info I was looking for.

Collins has been a great tool. Thanks for releasing it.

AJ

@bmatheny

I'm pasting below a few callbacks that we're using today at Tumblr. The reason the docs aren't up to date on these is that we have a major internal refactor coming up and were going to hold off. I'll keep the issue open until the update is done, but hopefully the stuff below is useful.

callbacks.registry {
  provisionVlan {
    on = "asset_update"
    when {
      previous.state = "isProvisioning"
      current.state = "isProvisioned"
    }
    action {
      type = exec
      command = "/opt/ruby-1.9.2/bin/visioner envision ewr_finish_provisioning --config=/usr/local/collins/config/production_ewr01.yaml --tag=<tag> --profile=discovery --trace --logfile=/tmp/<tag>-provision.log --app=/opt/visioner_apps/current/"
    }
  }

  hardwareProblem {
    on = "asset_update"

    when {
      previous.state = "!isMaintenance"
      current.state = "isMaintenance"
      current.states = [
        IPMI_PROBLEM,
        HARDWARE_PROBLEM,
        HARDWARE_UPGRADE,
        NETWORK_PROBLEM
      ]
    }

    action {
      type = exec
      command = "/opt/ruby-1.9.2/bin/visioner envision notify --config=/usr/local/collins/config/production_ewr01.yaml --tag=<tag> --recipient=jira-infra@tumblr.com --trace --logfile=/tmp/<tag>-maintenance.log --app=/opt/visioner_apps/current/"
    }
  }

}

The substitutions available are the methods on each object. If you subscribe to an asset_meta_value_create you have access to all the values on the AssetMetaValue case class. The most useful one is probably <value>, if more are needed (<assetTag> seems useful, it's trivial to add).

@icebourg

Blake,

That's indeed very helpful and a great pointer for me as I start to mess around with callbacks. Thanks!!

AJ

@cburroughs

Refactor of the callback mechanism in collins, or of visioner and the other things using it?

@bmatheny

The callback mechanism (there's a PR for it), although the change is backwards compatible. Visioner we intend on open sourcing at some point (not much magic, just helpers for dealing with lots of different systems).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.