Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial commit of project skeleton

  • Loading branch information...
commit ac7366f8d8d7e26a51e5985b7e96c0e0a1219629 1 parent e0cb76a
J.B. Zimmerman authored
View
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in knife-flow.gemspec
+gemspec
View
45 README.md
@@ -0,0 +1,45 @@
+knife-survey
+========
+A Chef plugin for determining which cookbooks are in use on which nodes of your Chef server or Opscode organization.
+Allows you to safely maintain a chef cookbook set by determining which cookbooks are currently in use by nodes (included in node runlists).
+
+Requirements
+---------------
+
+Installing knife-survey
+-------------------
+Be sure you are running the latest version of Chef.
+
+ gem install knife-flow
+
+
+Plugins
+---------------
+
+### survey
+
+ knife survey \<COOKBOOK COOKBOOK ...\>
+
+
+
+License terms
+-------------
+Authors:: Jacob Zimmerman
+
+Copyright:: Copyright (c) 2009-2011 Medidata Solutions Worldwide, Inc.
+
+License:: Apache License, Version 2.0
+
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
View
1  Rakefile
@@ -0,0 +1 @@
+require 'bundler/gem_tasks'
View
20 knife-survey.gemspec
@@ -0,0 +1,20 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "knife-survey/version"
+
+Gem::Specification.new do |s|
+ s.name = "knife-survey"
+ s.version = Knife::Survey::VERSION
+ s.authors = ["Jacob Zimmerman"]
+ s.email = ["jzimmerman@mdsol.com"]
+ s.homepage = "https://github.com/mdsol/knife-survey"
+ s.summary = %q{A Chef plugin for determining which cookbooks are in use on which nodes of your Chef server or Opscode organization.}
+ s.description = %q{Allows you to safely maintain a chef cookbook set by determining which cookbooks are currently in use by nodes (included in node runlists).}
+
+ s.rubyforge_project = "knife-survey"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+end
View
62 lib/chef/knife/survey.rb
@@ -0,0 +1,62 @@
+#
+## Author:: Jacob Zimmermann (<jzimmerman@mdsol.com>)
+##
+## Licensed under the Apache License, Version 2.0 (the "License");
+## you may not use this file except in compliance with the License.
+## You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+##
+#
+
+require 'chef/knife'
+
+module KnifeSurvey
+ class Promote < Chef::Knife
+
+ deps do
+ require 'chef/cookbook_loader'
+ require 'chef/environment'
+ require 'chef/knife/core/object_loader'
+ end
+
+ banner "knife survey <COOKBOOK COOKBOOK ...>"
+
+
+ def run
+
+ all_args = parse_name_args!
+ cookbooks = all_args
+
+ self.config = Chef::Config.merge!(config)
+
+
+ # 1) Get a list of cookbooks available on the current server/org
+
+ # 2) Get a list of nodes known to the current server/org
+
+ # 3) Iterate over each node
+
+ # 3a) Get node's runlist
+
+ # 3b) Add the cookbooks/recipes in node's runlist to the node array's 'runlist' hash
+
+ # 3c) For each recognized cookbook in the runlist, add to that cookbook's count variable
+
+ # 4) Output total counts for each cookbook in cookbook list
+
+ # 5) Output complete node/cookbook array
+
+
+ end # 'run' def end
+
+
+ end #class end
+
+end #module end
View
5 lib/knife-survey/version.rb
@@ -0,0 +1,5 @@
+module Knife
+ module Survey
+ VERSION = "0.0.1"
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.