pot 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/CREDITS +32 -0
- data/LICENSE +20 -0
- data/README.md +21 -0
- data/bin/pot-console +9 -0
- data/lib/pot.rb +17 -0
- data/lib/pot/actor.rb +34 -0
- data/lib/pot/bundle.rb +66 -0
- data/lib/pot/config.rb +33 -0
- data/lib/pot/console.rb +7 -0
- data/lib/pot/deployment.rb +91 -0
- data/lib/pot/dsl.rb +39 -0
- data/lib/pot/installer.rb +131 -0
- data/lib/pot/installers/apt.rb +52 -0
- data/lib/pot/installers/binary.rb +46 -0
- data/lib/pot/installers/brew.rb +34 -0
- data/lib/pot/installers/deb.rb +41 -0
- data/lib/pot/installers/gem.rb +64 -0
- data/lib/pot/installers/group.rb +15 -0
- data/lib/pot/installers/npm.rb +19 -0
- data/lib/pot/installers/push_text.rb +49 -0
- data/lib/pot/installers/rake.rb +37 -0
- data/lib/pot/installers/replace_text.rb +45 -0
- data/lib/pot/installers/runner.rb +20 -0
- data/lib/pot/installers/source.rb +202 -0
- data/lib/pot/installers/transfer.rb +184 -0
- data/lib/pot/installers/user.rb +15 -0
- data/lib/pot/instance.rb +21 -0
- data/lib/pot/logger.rb +41 -0
- data/lib/pot/package.rb +352 -0
- data/lib/pot/policy.rb +74 -0
- data/lib/pot/role.rb +16 -0
- data/lib/pot/template.rb +20 -0
- data/lib/pot/transports/local.rb +31 -0
- data/lib/pot/transports/ssh.rb +81 -0
- data/lib/pot/verifiers/apt.rb +21 -0
- data/lib/pot/verifiers/brew.rb +21 -0
- data/lib/pot/verifiers/directory.rb +16 -0
- data/lib/pot/verifiers/executable.rb +53 -0
- data/lib/pot/verifiers/file.rb +34 -0
- data/lib/pot/verifiers/process.rb +21 -0
- data/lib/pot/verifiers/ruby.rb +25 -0
- data/lib/pot/verifiers/symlink.rb +30 -0
- data/lib/pot/verifiers/users_groups.rb +33 -0
- data/lib/pot/verify.rb +112 -0
- data/lib/pot/version.rb +13 -0
- metadata +118 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
module Pot
|
2
|
+
module Verifiers
|
3
|
+
# = Users and groups Verifier
|
4
|
+
#
|
5
|
+
# Tests for the existance of users and groups.
|
6
|
+
#
|
7
|
+
# == Example Usage
|
8
|
+
#
|
9
|
+
# verify do
|
10
|
+
# has_user 'ntp'
|
11
|
+
# has_user 'noone', :in_group => 'nobody'
|
12
|
+
# has_group 'nobody'
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
module UsersGroups
|
16
|
+
Pot::Verify.register(Pot::Verifiers::UsersGroups)
|
17
|
+
|
18
|
+
# Tests that the user exists
|
19
|
+
def has_user(user, opts = {})
|
20
|
+
if opts[:in_group]
|
21
|
+
@commands << "id -nG #{user} | xargs -n1 echo | grep #{opts[:in_group]}"
|
22
|
+
else
|
23
|
+
@commands << "id #{user}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Tests that the group exists
|
28
|
+
def has_group(group)
|
29
|
+
@commands << "id -g #{group}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/pot/verify.rb
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
module Pot
|
2
|
+
# = Verification Methods
|
3
|
+
#
|
4
|
+
# As documented in Pot::Package, you may define a block on a package
|
5
|
+
# which verifies that a package was installed correctly. If this verification
|
6
|
+
# block fails, Pot will stop the script gracefully, raising the error.
|
7
|
+
#
|
8
|
+
# In addition to checking post install if it was successfully, verification
|
9
|
+
# blocks are also run before an install to see if a package is <em>already</em>
|
10
|
+
# installed. If this is the case, the package is skipped and Pot continues
|
11
|
+
# with the next package. This behavior can be overriden by setting the -f flag on
|
12
|
+
# the Pot script or setting Pot.config.force to true if you're
|
13
|
+
# using Pot programmatically.
|
14
|
+
#
|
15
|
+
# == An Example
|
16
|
+
#
|
17
|
+
# The following verifies that rails was installed correctly be checking to see
|
18
|
+
# if the 'rails' command is available on the command line:
|
19
|
+
#
|
20
|
+
# package :rails do
|
21
|
+
# gem 'rails'
|
22
|
+
#
|
23
|
+
# verify do
|
24
|
+
# has_executable 'rails'
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# == Available Verifiers
|
29
|
+
#
|
30
|
+
# There are a variety of available methods for use in the verification block.
|
31
|
+
# The standard methods are defined in the Pot::Verifiers module, so see
|
32
|
+
# their corresponding documentation.
|
33
|
+
#
|
34
|
+
# == Custom Verifiers
|
35
|
+
#
|
36
|
+
# If you feel that the built-in verifiers do not offer a certain aspect of
|
37
|
+
# verification which you need, you may create your own verifier! Simply wrap
|
38
|
+
# any method in a module which you want to use:
|
39
|
+
#
|
40
|
+
# module MagicBeansVerifier
|
41
|
+
# def has_magic_beans(sauce)
|
42
|
+
# @commands << '[ -z "`echo $' + sauce + '`"]'
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# The method can append as many commands as it wishes to the @commands array.
|
47
|
+
# These commands will be run on the remote server and <b>MUST</b> give an
|
48
|
+
# exit status of 0 if successful or other if unsuccessful.
|
49
|
+
#
|
50
|
+
# To register your verifier, call the register method on Pot::Verify:
|
51
|
+
#
|
52
|
+
# Sprinle::Verify.register(MagicBeansVerifier)
|
53
|
+
#
|
54
|
+
# And now you may use it like any other verifier:
|
55
|
+
#
|
56
|
+
# package :magic_beans do
|
57
|
+
# gem 'magic_beans'
|
58
|
+
#
|
59
|
+
# verify { has_magic_beans('ranch') }
|
60
|
+
# end
|
61
|
+
class Verify
|
62
|
+
# include Pot::Configurable
|
63
|
+
attr_accessor :package, :description, :commands #:nodoc:
|
64
|
+
|
65
|
+
class <<self
|
66
|
+
# Register a verification module
|
67
|
+
def register(new_module)
|
68
|
+
class_eval { include new_module }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def initialize(package, description = '', &block) #:nodoc:
|
73
|
+
raise 'Verify requires a block.' unless block
|
74
|
+
|
75
|
+
@package = package
|
76
|
+
@description = description
|
77
|
+
@commands = []
|
78
|
+
@options ||= {}
|
79
|
+
@options[:padding] = 4
|
80
|
+
|
81
|
+
self.instance_eval(&block)
|
82
|
+
end
|
83
|
+
|
84
|
+
def process(actor, pre = false) #:nodoc:
|
85
|
+
description = @description.empty? ? @package.name : @description
|
86
|
+
|
87
|
+
if Pot.logger.debug?
|
88
|
+
Pot.logger.debug "#{@package.name}#{description} verification sequence: #{@commands.join('; ')}\n"
|
89
|
+
end
|
90
|
+
|
91
|
+
unless Pot.config.testing?
|
92
|
+
Pot.logger.info "#{" " * @options[:padding]}--> Verifying #{description}..."
|
93
|
+
|
94
|
+
unless actor.verify(self)
|
95
|
+
# Verification failed, halt sprinkling gracefully.
|
96
|
+
raise Pot::VerificationFailed.new(@package, description)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class VerificationFailed < Exception #:nodoc:
|
103
|
+
attr_accessor :package, :description
|
104
|
+
|
105
|
+
def initialize(package, description)
|
106
|
+
super("Verifying #{package.name} #{description} failed.")
|
107
|
+
|
108
|
+
@package = package
|
109
|
+
@description = description
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
data/lib/pot/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ingeniarius
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: net-ssh
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.6.6
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.6.6
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: net-scp
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.1.0
|
41
|
+
description: Software provisioning tool based on sprinkle
|
42
|
+
email:
|
43
|
+
- gem@ingeniarius.name
|
44
|
+
executables:
|
45
|
+
- pot-console
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- bin/pot-console
|
50
|
+
- lib/pot/actor.rb
|
51
|
+
- lib/pot/bundle.rb
|
52
|
+
- lib/pot/config.rb
|
53
|
+
- lib/pot/console.rb
|
54
|
+
- lib/pot/deployment.rb
|
55
|
+
- lib/pot/dsl.rb
|
56
|
+
- lib/pot/installer.rb
|
57
|
+
- lib/pot/installers/apt.rb
|
58
|
+
- lib/pot/installers/binary.rb
|
59
|
+
- lib/pot/installers/brew.rb
|
60
|
+
- lib/pot/installers/deb.rb
|
61
|
+
- lib/pot/installers/gem.rb
|
62
|
+
- lib/pot/installers/group.rb
|
63
|
+
- lib/pot/installers/npm.rb
|
64
|
+
- lib/pot/installers/push_text.rb
|
65
|
+
- lib/pot/installers/rake.rb
|
66
|
+
- lib/pot/installers/replace_text.rb
|
67
|
+
- lib/pot/installers/runner.rb
|
68
|
+
- lib/pot/installers/source.rb
|
69
|
+
- lib/pot/installers/transfer.rb
|
70
|
+
- lib/pot/installers/user.rb
|
71
|
+
- lib/pot/instance.rb
|
72
|
+
- lib/pot/logger.rb
|
73
|
+
- lib/pot/package.rb
|
74
|
+
- lib/pot/policy.rb
|
75
|
+
- lib/pot/role.rb
|
76
|
+
- lib/pot/template.rb
|
77
|
+
- lib/pot/transports/local.rb
|
78
|
+
- lib/pot/transports/ssh.rb
|
79
|
+
- lib/pot/verifiers/apt.rb
|
80
|
+
- lib/pot/verifiers/brew.rb
|
81
|
+
- lib/pot/verifiers/directory.rb
|
82
|
+
- lib/pot/verifiers/executable.rb
|
83
|
+
- lib/pot/verifiers/file.rb
|
84
|
+
- lib/pot/verifiers/process.rb
|
85
|
+
- lib/pot/verifiers/ruby.rb
|
86
|
+
- lib/pot/verifiers/symlink.rb
|
87
|
+
- lib/pot/verifiers/users_groups.rb
|
88
|
+
- lib/pot/verify.rb
|
89
|
+
- lib/pot/version.rb
|
90
|
+
- lib/pot.rb
|
91
|
+
- README.md
|
92
|
+
- LICENSE
|
93
|
+
- CREDITS
|
94
|
+
homepage: https://github.com/ingeniarius/pot
|
95
|
+
licenses:
|
96
|
+
- MIT
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.0.0
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: Software provisioning tool
|
118
|
+
test_files: []
|