puppet 3.0.0 → 3.0.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/Rakefile +24 -19
- data/bin/puppet +0 -6
- data/examples/modules/{sample-module.pp → sample_module.pp} +1 -1
- data/examples/modules/{sample-module → sample_module}/lib/puppet/parser/functions/hostname_to_dn.rb +0 -0
- data/examples/modules/{sample-module → sample_module}/manifests/init.pp +1 -1
- data/examples/modules/{sample-module → sample_module}/templates/sample.erb +0 -0
- data/ext/debian/puppetmaster.README.debian +1 -2
- data/ext/debian/puppetmaster.default +1 -28
- data/ext/debian/puppetmaster.init +49 -70
- data/ext/project_data.yaml +2 -2
- data/ext/rack/README +0 -15
- data/ext/rack/files/config.ru +4 -2
- data/ext/redhat/logrotate +1 -1
- data/ext/redhat/server.init +34 -49
- data/ext/redhat/server.sysconfig +2 -20
- data/ext/suse/client.init +10 -9
- data/ext/suse/puppet.spec +12 -25
- data/ext/suse/server.init +25 -15
- data/ext/windows/service/daemon.bat +1 -1
- data/ext/windows/service/daemon.rb +1 -1
- data/lib/puppet.rb +0 -6
- data/lib/puppet/application/agent.rb +1 -0
- data/lib/puppet/defaults.rb +2 -9
- data/lib/puppet/feature/eventlog.rb +0 -1
- data/lib/puppet/feature/rack.rb +1 -6
- data/lib/puppet/feature/rails.rb +0 -2
- data/lib/puppet/feature/rubygems.rb +5 -1
- data/lib/puppet/feature/ssh.rb +0 -1
- data/lib/puppet/feature/stomp.rb +0 -1
- data/lib/puppet/feature/zlib.rb +0 -1
- data/lib/puppet/network/http/rack/rest.rb +4 -1
- data/lib/puppet/rails/inventory_node.rb +26 -13
- data/lib/puppet/run.rb +1 -1
- data/lib/puppet/settings.rb +12 -7
- data/lib/puppet/util/command_line.rb +11 -0
- data/lib/puppet/util/rubygems.rb +7 -6
- data/lib/puppet/util/run_mode.rb +12 -11
- data/lib/puppet/util/zaml.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/man/man5/puppet.conf.5 +4 -4
- data/spec/integration/defaults_spec.rb +4 -4
- data/spec/unit/network/http/rack/rest_spec.rb +13 -0
- data/spec/unit/run_spec.rb +11 -5
- data/spec/unit/util/rubygems_spec.rb +4 -2
- data/spec/unit/util/run_mode_spec.rb +9 -0
- data/spec/unit/util/zaml_spec.rb +53 -25
- metadata +2189 -2210
- data/examples/modules/sample-module/README.txt +0 -17
- data/ext/packaging/README-Solaris.md +0 -117
- data/ext/packaging/README.md +0 -89
- data/ext/packaging/tasks/00_utils.rb +0 -290
- data/ext/packaging/tasks/10_setupvars.rake +0 -64
- data/ext/packaging/tasks/apple.rake +0 -201
- data/ext/packaging/tasks/clean.rake +0 -5
- data/ext/packaging/tasks/deb.rake +0 -103
- data/ext/packaging/tasks/gem.rake +0 -55
- data/ext/packaging/tasks/ips.rake +0 -80
- data/ext/packaging/tasks/mock.rake +0 -88
- data/ext/packaging/tasks/release.rake +0 -56
- data/ext/packaging/tasks/rpm.rake +0 -39
- data/ext/packaging/tasks/ship.rake +0 -36
- data/ext/packaging/tasks/sign.rake +0 -79
- data/ext/packaging/tasks/tag.rake +0 -8
- data/ext/packaging/tasks/tar.rake +0 -20
- data/ext/packaging/tasks/version.rake +0 -20
- data/ext/suse/fileserver.conf +0 -12
- data/ext/suse/logrotate +0 -10
- data/ext/suse/puppet.conf +0 -25
- data/lib/puppet/network/http/mongrel/rest.rb +0 -104
- data/spec/integration/network/server/mongrel_spec.rb +0 -64
@@ -1,17 +0,0 @@
|
|
1
|
-
Jeff McCune <jeff.mccune@northstarlabs.net>
|
2
|
-
2007-08-14
|
3
|
-
|
4
|
-
This small, sample module demonstrates how to extend the puppet language
|
5
|
-
with a new parser function.
|
6
|
-
|
7
|
-
See:
|
8
|
-
manifests/init.pp
|
9
|
-
lib/puppet/parser/functions/hostname_to_dn.rb
|
10
|
-
templates/sample.erb
|
11
|
-
|
12
|
-
Note the consistent naming of files for Puppet::Util::Autoload
|
13
|
-
|
14
|
-
Reference Documents:
|
15
|
-
http://docs.puppetlabs.com/guides/modules.html
|
16
|
-
http://docs.puppetlabs.com/guides/custom_functions.html
|
17
|
-
http://docs.puppetlabs.com/references/latest/function.html
|
@@ -1,117 +0,0 @@
|
|
1
|
-
## Create self signed certificate
|
2
|
-
|
3
|
-
- Generate the key pair
|
4
|
-
|
5
|
-
| keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
|
6
|
-
|
7
|
-
|
8
|
-
- Extract Certificate
|
9
|
-
|
10
|
-
| keytool -export -rfc -keystore keystore.jks -storepass password -alias selfsigned -file mycert.pem
|
11
|
-
|
12
|
-
- Extract Cert Key to PEM format
|
13
|
-
|
14
|
-
| keytool -importkeystore -srcstoretype JKS -srckeystore keystore.jks -deststoretype PKCS12 -destkeystore mykey.der
|
15
|
-
| openssl pkcs12 -in mykey.der -nodes -out mykey.pem
|
16
|
-
|
17
|
-
## For installation.
|
18
|
-
|
19
|
-
- Check the publishers
|
20
|
-
|
21
|
-
| pkg publisher
|
22
|
-
solaris origin online http://pkg.oracle.com/solaris/release/
|
23
|
-
|
24
|
-
- Add puppetlabs.com as a publisher
|
25
|
-
|
26
|
-
| pkg set-publisher -p http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net puppetlabs.com
|
27
|
-
|
28
|
-
- Check that we have it correct
|
29
|
-
|
30
|
-
| pkg publisher
|
31
|
-
solaris origin online http://pkg.oracle.com/solaris/release/
|
32
|
-
puppetlabs.com origin online http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
|
33
|
-
|
34
|
-
- Verify that puppetlabs.com was set correctly,
|
35
|
-
|
36
|
-
| pkg publisher puppetlabs.com
|
37
|
-
Publisher: puppetlabs.com
|
38
|
-
Alias:
|
39
|
-
Origin URI: http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
|
40
|
-
SSL Key: None
|
41
|
-
SSL Cert: None
|
42
|
-
Client UUID: 37084c4a-fdc6-11e1-832b-8800273bd610
|
43
|
-
Catalog Updated: September 13, 2012 08:31:25 PM
|
44
|
-
Enabled: Yes
|
45
|
-
Signature Policy: verify
|
46
|
-
|
47
|
-
- Try installing puppet
|
48
|
-
|
49
|
-
| pkg install puppet
|
50
|
-
Creating Plan |
|
51
|
-
pkg install: Chain was rooted in an untrusted self-signed certificate.
|
52
|
-
The package involved is:pkg://puppetlabs.com/system/management/puppet@3.0.0,5.11-6.192:20120913T212942Z
|
53
|
-
|
54
|
-
- We have two choices here, first, to ignore the signature policy for both publisher and image
|
55
|
-
|
56
|
-
| pkg set-publisher --set-property=signature-policy=ignore puppetlabs.com
|
57
|
-
| pkg publisher puppetlabs.com
|
58
|
-
Publisher: puppetlabs.com
|
59
|
-
Alias:
|
60
|
-
Origin URI: http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
|
61
|
-
SSL Key: None
|
62
|
-
SSL Cert: None
|
63
|
-
Client UUID: 140bb5c8-fe62-11e1-af70-8800273bd610
|
64
|
-
Catalog Updated: September 14, 2012 05:11:45 PM
|
65
|
-
Enabled: Yes
|
66
|
-
Signature Policy: ignore
|
67
|
-
| pkg set-property signature-policy ignore
|
68
|
-
| pkg install puppet
|
69
|
-
|
70
|
-
- Or trust the self signed certificate from puppetlabs.com (this certificate needs to be published in our web site)
|
71
|
-
|
72
|
-
| pkg set-publisher --approve-ca-cert /root/mycert.pem puppetlabs.com
|
73
|
-
|
74
|
-
- Verify that approve cert went well.
|
75
|
-
|
76
|
-
| pkg publisher puppetlabs.com
|
77
|
-
|
78
|
-
Publisher: puppetlabs.com
|
79
|
-
Alias:
|
80
|
-
Origin URI: http://solaris-11-ips-repo.acctest.dc1.puppetlabs.net/
|
81
|
-
SSL Key: None
|
82
|
-
SSL Cert: None
|
83
|
-
Client UUID: 37084c4a-fdc6-11e1-832b-8800273bd610
|
84
|
-
Catalog Updated: September 13, 2012 08:31:25 PM
|
85
|
-
Approved CAs: 791b5791a81e9c2eb3fb9f84f4f86f8ea6fcd672
|
86
|
-
Enabled: Yes
|
87
|
-
Signature Policy: verify
|
88
|
-
|
89
|
-
| pkg install puppet
|
90
|
-
|
91
|
-
- Checking about information on the package (See the human readable version string)
|
92
|
-
|
93
|
-
| pkg info -r puppet
|
94
|
-
Name: system/management/puppet
|
95
|
-
Summary: Puppet, an automated configuration management tool
|
96
|
-
Description: Puppet, an automated configuration management tool
|
97
|
-
Category: System/Administration and Configuration
|
98
|
-
State: Not installed
|
99
|
-
Publisher: puppetlabs.com
|
100
|
-
Version: 3.0.0 (3.0.0-rc6)
|
101
|
-
Build Release: 5.11
|
102
|
-
Branch: 6.170
|
103
|
-
Packaging Date: September 14, 2012 06:11:05 PM
|
104
|
-
Size: 2.43 MB
|
105
|
-
FMRI: pkg://puppetlabs.com/system/management/puppet@3.0.0,5.11-6.170:20120914T181105Z
|
106
|
-
|
107
|
-
- Check license
|
108
|
-
|
109
|
-
| pkg info -r --license puppet
|
110
|
-
Puppet - Automating Configuration Management.
|
111
|
-
|
112
|
-
Copyright (C) 2005-2012 Puppet Labs Inc
|
113
|
-
|
114
|
-
|
115
|
-
- Reference
|
116
|
-
|
117
|
-
http://docs.oracle.com/cd/E19963-01/html/820-6572/managepkgs.html
|
data/ext/packaging/README.md
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
Packaging
|
2
|
-
|
3
|
-
This is a repository for packaging artifacts for Puppet Labs software.
|
4
|
-
The goal is to abstract and automate packaging processes beyond individual
|
5
|
-
software projects to a level where this repo can be cloned inside any
|
6
|
-
project and used to build Debian and Redhat packages.
|
7
|
-
|
8
|
-
It expects the following directory structure in the project
|
9
|
-
* ext/{debian,redhat,osx}
|
10
|
-
|
11
|
-
each of which contains templated erb files using the instance variables
|
12
|
-
specified in the setupvars task. These include a debian changelog, a
|
13
|
-
redhat spec file, and an osx preflight and plist.
|
14
|
-
|
15
|
-
The top level Rakefile in the project should have the following added:
|
16
|
-
```ruby
|
17
|
-
Dir['ext/packaging/tasks/**/*'].sort.each { |t| load t }
|
18
|
-
begin
|
19
|
-
@build_defaults ||= YAML.load_file('ext/build_defaults.yaml')
|
20
|
-
@packaging_url = @build_defaults['packaging_url']
|
21
|
-
@packaging_repo = @build_defaults['packaging_repo']
|
22
|
-
rescue
|
23
|
-
STDERR.puts "Unable to read the packaging repo from ext/build_defaults.yaml"
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
namespace :package do
|
28
|
-
desc "Bootstrap packaging automation, e.g. clone into packaging repo"
|
29
|
-
task :bootstrap do
|
30
|
-
cd 'ext' do
|
31
|
-
%x{git clone #{@packaging_url}}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
desc "Remove all cloned packaging automation"
|
36
|
-
task :implode do
|
37
|
-
rm_rf "ext/#{@packaging_repo}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
```
|
41
|
-
|
42
|
-
Also in ext should be two files, build_defaults.yaml and project_data.yaml.
|
43
|
-
|
44
|
-
This is the sample build_defaults.yaml file from Hiera:
|
45
|
-
```yaml
|
46
|
-
---
|
47
|
-
packaging_url: 'git@github.com:puppetlabs/packaging --branch=master'
|
48
|
-
packaging_repo: 'packaging'
|
49
|
-
default_cow: 'base-squeeze-i386.cow'
|
50
|
-
cows: 'base-lucid-amd64.cow base-lucid-i386.cow base-natty-amd64.cow base-natty-i386.cow base-oneiric-amd64.cow base-oneiric-i386.cow base-precise-amd64.cow base-precise-i386.cow base-sid-amd64.cow base-sid-i386.cow base-squeeze-amd64.cow base-squeeze-i386.cow base-testing-amd64.cow base-testing-i386.cow base-wheezy-i386.cow'
|
51
|
-
pbuild_conf: '/etc/pbuilderrc'
|
52
|
-
packager: 'puppetlabs'
|
53
|
-
gpg_name: 'info@puppetlabs.com'
|
54
|
-
gpg_key: '4BD6EC30'
|
55
|
-
sign_tar: FALSE
|
56
|
-
# a space separated list of mock configs
|
57
|
-
final_mocks: 'pl-5-i386 pl-5-x86_64 pl-6-i386 pl-6-x86_64 fedora-15-i386 fedora-15-x86_64 fedora-16-i386 fedora-16-x86_64 fedora-17-i386 fedora-17-x86_64'
|
58
|
-
rc_mocks: 'pl-5-i386-dev pl-5-x86_64-dev pl-6-i386-dev pl-6-x86_64-dev fedora-15-i386-dev fedora-15-x86_64-dev fedora-16-i386-dev fedora-16-x86_64-dev fedora-17-i386-dev fedora-17-x86_64-dev'
|
59
|
-
yum_host: 'burji.puppetlabs.com'
|
60
|
-
yum_repo_path: '~/repo/'
|
61
|
-
apt_host: 'burji.puppetlabs.com'
|
62
|
-
apt_repo_url: 'http://apt.puppetlabs.com'
|
63
|
-
apt_repo_path: '/opt/repository/incoming'
|
64
|
-
# Whether to present the gem and apple tasks
|
65
|
-
build_gem: TRUE
|
66
|
-
build_dmg: TRUE
|
67
|
-
```
|
68
|
-
This is the sample project_data.yaml file:
|
69
|
-
```yaml
|
70
|
-
---
|
71
|
-
project: 'hiera'
|
72
|
-
author: 'Puppet Labs'
|
73
|
-
email: 'info@puppetlabs.com'
|
74
|
-
homepage: 'https://github.com/puppetlabs/hiera'
|
75
|
-
summary: 'Light weight hierarchical data store'
|
76
|
-
description: 'A pluggable data store for hierarcical data'
|
77
|
-
version_file: '/lib/hiera.rb'
|
78
|
-
# files and gem_files are space separated lists
|
79
|
-
files: '[A-Z]* ext lib bin spec acceptance_tests'
|
80
|
-
gem_files: '{bin,lib}/**/* CHANGELOG COPYING README.md LICENSE'
|
81
|
-
gem_require_path: 'lib'
|
82
|
-
gem_test_files: 'spec/**/*'
|
83
|
-
gem_executables: 'hiera'
|
84
|
-
gem_default_executables: 'hiera'
|
85
|
-
# To add gem dependencies, indent.
|
86
|
-
# This is an example only, hiera doesn't really depend on hiera-puppet
|
87
|
-
gem_dependencies:
|
88
|
-
hiera-puppet: '1.0.0rc'
|
89
|
-
```
|
@@ -1,290 +0,0 @@
|
|
1
|
-
# Utility methods used by the various rake tasks
|
2
|
-
|
3
|
-
def check_tool(tool)
|
4
|
-
%x{which #{tool}}
|
5
|
-
unless $?.success?
|
6
|
-
STDERR.puts "#{tool} tool not found...exiting"
|
7
|
-
exit 1
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def has_tool(tool)
|
12
|
-
%x{which #{tool}}
|
13
|
-
return $?.success?
|
14
|
-
end
|
15
|
-
|
16
|
-
def find_tool(tool)
|
17
|
-
location = %x{which #{tool}}.chomp
|
18
|
-
location if $?.success?
|
19
|
-
end
|
20
|
-
|
21
|
-
def check_file(file)
|
22
|
-
unless File.exist?(file)
|
23
|
-
STDERR.puts "#{file} file not found...exiting"
|
24
|
-
exit 2
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def check_var(varname,var=nil)
|
29
|
-
if var.nil?
|
30
|
-
STDERR.puts "Requires #{varname} be set...exiting"
|
31
|
-
exit 3
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def check_host(host)
|
36
|
-
unless host == %x{hostname}.chomp!
|
37
|
-
STDERR.puts "Requires host to be #{host}...exiting"
|
38
|
-
exit 5
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def erb(erbfile, outfile)
|
43
|
-
template = File.read(erbfile)
|
44
|
-
message = ERB.new(template, nil, "-")
|
45
|
-
output = message.result(binding)
|
46
|
-
File.open(outfile, 'w') { |f| f.write output }
|
47
|
-
puts "Generated: #{outfile}"
|
48
|
-
end
|
49
|
-
|
50
|
-
def cp_pr(src, dest, options={})
|
51
|
-
mandatory = {:preserve => true}
|
52
|
-
cp_r(src, dest, options.merge(mandatory))
|
53
|
-
end
|
54
|
-
|
55
|
-
def cp_p(src, dest, options={})
|
56
|
-
mandatory = {:preserve => true}
|
57
|
-
cp(src, dest, options.merge(mandatory))
|
58
|
-
end
|
59
|
-
|
60
|
-
def mv_f(src, dest, options={})
|
61
|
-
force = {:force => true}
|
62
|
-
mv(src, dest, options.merge(mandatory))
|
63
|
-
end
|
64
|
-
|
65
|
-
def git_co(dist)
|
66
|
-
%x{git reset --hard ; git checkout #{dist}}
|
67
|
-
unless $?.success?
|
68
|
-
STDERR.puts 'Could not checkout #{dist} git branch to build package from...exiting'
|
69
|
-
exit 1
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def get_temp
|
74
|
-
temp = `mktemp -d -t tmpXXXXXX`.strip
|
75
|
-
end
|
76
|
-
|
77
|
-
def remote_ssh_cmd target, command
|
78
|
-
check_tool('ssh')
|
79
|
-
puts "Executing '#{command}' on #{target}"
|
80
|
-
%x{ssh #{target} '#{command}'}
|
81
|
-
end
|
82
|
-
|
83
|
-
def rsync_to *args
|
84
|
-
check_tool('rsync')
|
85
|
-
flags = "-Havxl -O --no-perms --no-owner --no-group"
|
86
|
-
source = args[0]
|
87
|
-
target = args[1]
|
88
|
-
dest = args[2]
|
89
|
-
puts "rsyncing #{source} to #{target}"
|
90
|
-
%x{rsync #{flags} #{source} #{ENV['USER']}@#{target}:#{dest}}
|
91
|
-
end
|
92
|
-
|
93
|
-
def scp_file_from(host,path,file)
|
94
|
-
%x{scp #{ENV['USER']}@#{host}:#{path}/#{file} #{@tempdir}/#{file}}
|
95
|
-
end
|
96
|
-
|
97
|
-
def scp_file_to(host,path,file)
|
98
|
-
%x{scp #{@tempdir}/#{file} #{ENV['USER']}@#{host}:#{path}}
|
99
|
-
end
|
100
|
-
|
101
|
-
def timestamp
|
102
|
-
Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
103
|
-
end
|
104
|
-
|
105
|
-
def get_dash_version
|
106
|
-
if File.exists?('.git')
|
107
|
-
%x{git describe}.chomp.split('-')[0..1].join('-').gsub('v','')
|
108
|
-
else
|
109
|
-
get_pwd_version
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def get_ips_version
|
114
|
-
if File.exists?('.git')
|
115
|
-
desc = %x{git describe}.chomp.split(/[.-]/)
|
116
|
-
commits = %x{git log --oneline --no-merges | wc -l}.chomp.strip
|
117
|
-
osrelease = %x{uname -r}.chomp
|
118
|
-
"%s.%s.%s,#{osrelease}-%s" % [ desc[0],desc[1], desc[2], commits]
|
119
|
-
else
|
120
|
-
get_pwd_version
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
def get_dot_version
|
125
|
-
if File.exists?('.git')
|
126
|
-
%x{git describe}.chomp.gsub('-', '.').split('.')[0..3].join('.').gsub('v', '')
|
127
|
-
else
|
128
|
-
get_pwd_version
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
def get_pwd_version
|
133
|
-
%x{pwd}.strip.split('.')[-1]
|
134
|
-
end
|
135
|
-
|
136
|
-
def get_debversion
|
137
|
-
(@version.include?("rc") ? @version.sub(/rc[0-9]+/, '0.1\0') : "#{@version.gsub('-','.')}-1") + "#{@packager}#{get_debrelease}"
|
138
|
-
end
|
139
|
-
|
140
|
-
def get_origversion
|
141
|
-
@debversion.split('-')[0]
|
142
|
-
end
|
143
|
-
|
144
|
-
def get_rpmversion
|
145
|
-
@version.match(/^([0-9.]+)/)[1]
|
146
|
-
end
|
147
|
-
|
148
|
-
def get_version_file_version
|
149
|
-
# Match version files containing 'VERSION = "x.x.x"' and just x.x.x
|
150
|
-
contents = IO.read(@version_file)
|
151
|
-
if version_string = contents.match(/VERSION =.*/)
|
152
|
-
version_string.to_s.split()[-1]
|
153
|
-
else
|
154
|
-
contents
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
def get_debrelease
|
159
|
-
ENV['RELEASE'] || '1'
|
160
|
-
end
|
161
|
-
|
162
|
-
def get_rpmrelease
|
163
|
-
ENV['RELEASE'] ||
|
164
|
-
if @version.include?("rc")
|
165
|
-
"0.1" + @version.gsub('-', '_').match(/rc[0-9]+.*/)[0]
|
166
|
-
else
|
167
|
-
"1"
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
def load_keychain
|
172
|
-
unless @keychain_loaded
|
173
|
-
kill_keychain
|
174
|
-
start_keychain
|
175
|
-
@keychain_loaded = TRUE
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
def kill_keychain
|
180
|
-
%x{keychain -k mine}
|
181
|
-
end
|
182
|
-
|
183
|
-
def start_keychain
|
184
|
-
keychain = %x{/usr/bin/keychain -q --agents gpg --eval #{@gpg_key}}.chomp
|
185
|
-
new_env = keychain.match(/(GPG_AGENT_INFO)=([^;]*)/)
|
186
|
-
ENV[new_env[1]] = new_env[2]
|
187
|
-
end
|
188
|
-
|
189
|
-
def gpg_sign_file(file)
|
190
|
-
gpg ||= find_tool('gpg')
|
191
|
-
|
192
|
-
if gpg
|
193
|
-
sh "#{gpg} --armor --detach-sign -u #{@gpg_key} #{file}"
|
194
|
-
else
|
195
|
-
STDERR.puts "No gpg available. Cannot sign tarball. Exiting..."
|
196
|
-
exit 1
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
def mkdir_pr *args
|
201
|
-
args.each do |arg|
|
202
|
-
mkdir_p arg
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
def set_cow_envs(cow)
|
207
|
-
elements = cow.split('-')
|
208
|
-
if elements.size != 3
|
209
|
-
STDERR.puts "Expecting a cow name split on hyphens, e.g. 'base-squeeze-i386'"
|
210
|
-
exit 1
|
211
|
-
else
|
212
|
-
dist = elements[1]
|
213
|
-
arch = elements[2]
|
214
|
-
if dist.nil? or arch.nil?
|
215
|
-
STDERR.puts "Couldn't get the arg and dist from cow name. Expecting something like 'base-dist-arch'"
|
216
|
-
exit 1
|
217
|
-
end
|
218
|
-
arch = arch.split('.')[0] if arch.include?('.')
|
219
|
-
end
|
220
|
-
|
221
|
-
ENV['DIST'] = dist
|
222
|
-
ENV['ARCH'] = arch
|
223
|
-
end
|
224
|
-
|
225
|
-
def ln(target, name)
|
226
|
-
%x{ln -f #{target} #{name}}
|
227
|
-
end
|
228
|
-
|
229
|
-
def git_commit_file(file)
|
230
|
-
%x{which git &> /dev/null}
|
231
|
-
if $?.success? and File.exist?('.git')
|
232
|
-
%x{git commit #{file} -m "Commit changes to #{file}" &> /dev/null}
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
def ship_gem(file)
|
237
|
-
%x{gem push #{file}}
|
238
|
-
end
|
239
|
-
|
240
|
-
def x(v)
|
241
|
-
puts %[#{v}]
|
242
|
-
print %x[#{v}]
|
243
|
-
end
|
244
|
-
|
245
|
-
def ask_yes_or_no
|
246
|
-
answer = STDIN.gets.downcase.chomp
|
247
|
-
return TRUE if answer =~ /^y$|^yes$/
|
248
|
-
return FALSE if answer =~ /^n$|^no$/
|
249
|
-
puts "Nope, try something like yes or no or y or n, etc:"
|
250
|
-
ask_yes_or_no
|
251
|
-
end
|
252
|
-
|
253
|
-
def handle_method_failure(method, args)
|
254
|
-
STDERR.puts "There was an error running the method #{method} with the arguments:"
|
255
|
-
args.each { |param, arg| STDERR.puts "\t#{param} => #{arg}\n" }
|
256
|
-
STDERR.puts "The rake session is paused. Would you like to retry #{method} with these args and continue where you left off? [y,n]"
|
257
|
-
if ask_yes_or_no
|
258
|
-
send(method, args)
|
259
|
-
else
|
260
|
-
exit 1
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
def invoke_task(task, args=nil)
|
265
|
-
Rake::Task[task].reenable
|
266
|
-
Rake::Task[task].invoke(args)
|
267
|
-
end
|
268
|
-
|
269
|
-
def confirm_ship(files)
|
270
|
-
STDOUT.puts "The following files have been built and are ready to ship:"
|
271
|
-
files.each { |file| STDOUT.puts "\t#{file}\n" unless File.directory?(file) }
|
272
|
-
STDOUT.puts "Ship these files?? [y,n]"
|
273
|
-
ask_yes_or_no
|
274
|
-
end
|
275
|
-
|
276
|
-
def boolean_value(var)
|
277
|
-
return TRUE if (var == TRUE || ( var.is_a?(String) && var.downcase == 'true' ))
|
278
|
-
FALSE
|
279
|
-
end
|
280
|
-
|
281
|
-
def git_tag(version)
|
282
|
-
begin
|
283
|
-
sh "git tag -s -u #{@gpg_key} -m '#{version}' #{version}"
|
284
|
-
rescue Exception => e
|
285
|
-
STDERR.puts e
|
286
|
-
STDERR.puts "Unable to tag repo at #{version}"
|
287
|
-
exit 1
|
288
|
-
end
|
289
|
-
end
|
290
|
-
|