pupistry 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb015d29aead0f609e5cab660c3a6e8438565bd6
4
- data.tar.gz: 7ac9aa4a7cd18d7bc3ea1fa6431d0636a8599c59
3
+ metadata.gz: b79b3dc39752440bd81aafabb9dd460c550ddf86
4
+ data.tar.gz: f7307271db6cde5388db0c241fa220c44f60659b
5
5
  SHA512:
6
- metadata.gz: d1a9b7489858b33f69aa23dd10521cda71a721f428f00a97808dafab95f6c59c697cd250c1dbad27e2f44645fbdb97cfd72aca61f29e9176326d12fb96e62a4f
7
- data.tar.gz: 50701a9b7a46b610353d809e16926e3526362a7408858c08f76e4793122bbc2a509e8898d9cea1ee531692fce8316db596dc85ff299b0ce63dac8dd1ead11f57
6
+ metadata.gz: f0d8168a17152895c342e4bca7e0b9b80111b1e32437abb6457666951fbc8f716734b8cea7b24ee6773a056aadd1827b4fcdae11c0f238e8a6df487d7ecbacae
7
+ data.tar.gz: 06ffa5171f0f98d60f83d8505594db730f18e52d2b24687b02347783c4f885e426dc09939c3fe359ff73fcd436777967eb90e2238bd9de459362a07997fb1198
data/README.md CHANGED
@@ -115,11 +115,10 @@ site-by-site (and you can still do it that way if you want), but if you want a
115
115
  nice easy life, Pupistry can generate you a bootstrap script for your platform.
116
116
 
117
117
  $ pupistry bootstrap
118
- - rhel-7
118
+ - centos-7
119
119
  - ubuntu-14.04
120
120
 
121
- $ pupistry boostrap --template rhel-7
122
- # Bootstrap for Red Hat Enterprise Linux Platform
121
+ $ pupistry boostrap --template centos-7
123
122
  # Compatible with RHEL 7, CentOS 7 and maybe other variations.
124
123
 
125
124
  rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm
@@ -355,19 +354,23 @@ is working nicely.
355
354
 
356
355
  ## Bootstrap Functionality
357
356
 
358
- Currently Pupistry only supports generation of bootstrap for CentOS 7 & Ubuntu
359
- 14.04. Other distributions will be added, but it may take time to get to your
360
- particular favourite distribution.
357
+ Currently Pupistry only supports generation of bootstrap for select popular
358
+ distributions and platforms. Other distributions will be added, but it may take
359
+ time to get to your particular favourite distribution.
361
360
 
362
361
  Note that it isn't a show stopper if support for your platform of choice
363
362
  doesn't yet exist - you can use pupistry with pretty much any nix platform,
364
363
  you'll just not have the handy advantage of automatically generated bootstrap
365
- for your servers.
364
+ for your servers. And in many cases, one of the existing ones can easily be
365
+ adapted to your platform of choice.
366
366
 
367
367
  If you do customise it for a different platform, pull requests are VERY
368
368
  welcome, I'll add pretty much any OS if you write a decent bootstrap template
369
369
  for it.
370
370
 
371
+ Please see resources/bootstrap/BOOTSTRAP_NOTES.md for more details on how to
372
+ write and debug bootstrap templates.
373
+
371
374
 
372
375
  ## Continious Deployment
373
376
 
data/bin/pupistry CHANGED
@@ -267,7 +267,8 @@ class CLI < Thor
267
267
 
268
268
 
269
269
  desc "bootstrap", "Generate a user-data bootstrap script for a node"
270
- method_option :template, :type => :string
270
+ method_option :template, :type => :string, :desc => 'The template you want to generate'
271
+ method_option :base64, :type => :boolean, :desc => 'Output in base64 format'
271
272
  def bootstrap
272
273
 
273
274
  # Thor seems to force class options to be defined repeatedly? :-/
@@ -289,6 +290,12 @@ class CLI < Thor
289
290
 
290
291
  templates = Pupistry::Bootstrap.new
291
292
  templates.build options[:template]
293
+
294
+ if options[:base64]
295
+ templates.output_base64
296
+ else
297
+ templates.output_plain
298
+ end
292
299
  else
293
300
  templates = Pupistry::Bootstrap.new
294
301
  templates.list
@@ -1,4 +1,5 @@
1
1
  require 'rubygems'
2
+ require "base64"
2
3
  require 'erubis'
3
4
 
4
5
  module Pupistry
@@ -6,6 +7,7 @@ module Pupistry
6
7
 
7
8
  class Bootstrap
8
9
  attr_accessor :template_dir
10
+ attr_accessor :contents
9
11
 
10
12
  def initialize
11
13
 
@@ -49,7 +51,9 @@ module Pupistry
49
51
 
50
52
 
51
53
  def build template
52
- # Build a template with the configured parameters already to go
54
+ # Build a template with the configured parameters already to go and save
55
+ # into the object, so it can be outputted in the desired format.
56
+
53
57
  $logger.debug "Generating a bootstrap script for #{template}"
54
58
 
55
59
  unless File.exists?("#{@template_dir}/#{template}.erb")
@@ -72,17 +76,30 @@ module Pupistry
72
76
 
73
77
  # Generate template using ERB
74
78
  begin
75
- template_contents = Erubis::Eruby.new(File.read("#{@template_dir}/#{template}.erb")).result(template_values)
79
+ @contents = Erubis::Eruby.new(File.read("#{@template_dir}/#{template}.erb")).result(template_values)
76
80
  rescue Exception => e
77
81
  $logger.error "An unexpected error occured when trying to generate the bootstrap template"
78
82
  raise e
79
83
  end
80
84
 
81
- # Output template
85
+ end
86
+
87
+ def output_plain
88
+ # Do nothing clever, just output the template data.
89
+ puts "-- Bootstrap Start --"
90
+ puts @contents
91
+ puts "-- Bootstrap End --"
92
+ end
93
+
94
+ def output_base64
95
+ # Some providers like AWS can accept the data in Base64 version which is
96
+ # smaller and less likely to get messed up by copy and paste or weird
97
+ # formatting issues.
82
98
  puts "-- Bootstrap Start --"
83
- puts template_contents
99
+ puts Base64.encode64(@contents)
84
100
  puts "-- Bootstrap End --"
85
101
  end
102
+
86
103
  end
87
104
  end
88
105
 
@@ -69,6 +69,9 @@ module Pupistry
69
69
  elsif File.exists?( File.expand_path "~/.pupistry/settings.yaml" )
70
70
  config = File.expand_path "~/.pupistry/settings.yaml"
71
71
 
72
+ elsif File.exists?("/usr/local/etc/pupistry/settings.yaml")
73
+ config = "/usr/local/etc/pupistry/settings.yaml"
74
+
72
75
  elsif File.exists?("/etc/pupistry/settings.yaml")
73
76
  config = "/etc/pupistry/settings.yaml"
74
77
 
@@ -36,7 +36,9 @@ general:
36
36
  # machines so we can popular bootstrap templates for you and automatically
37
37
  # check stuff like IAM permissions before you roll your hosts.
38
38
  agent:
39
- puppetcode: /etc/puppet/environents/
39
+ # Puppet3 doesn't care what this is, but if using Puppet4, you need to set it
40
+ # to /etc/puppetlabs/code/environments otherwise it blows up.
41
+ puppetcode: /etc/puppetlabs/code/environments
40
42
 
41
43
  # The AWS credentials with READ permission to the S3 bucket for downloading
42
44
  # artifact files. If unset, we try to figure it out from any AWS creds
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pupistry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jethro Carr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-15 00:00:00.000000000 Z
11
+ date: 2015-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-v1