cloud-mu 2.0.4 → 2.1.0beta
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 +5 -5
- data/README.md +6 -0
- data/ansible/roles/geerlingguy.firewall/LICENSE +20 -0
- data/ansible/roles/geerlingguy.firewall/README.md +93 -0
- data/ansible/roles/geerlingguy.firewall/defaults/main.yml +19 -0
- data/ansible/roles/geerlingguy.firewall/handlers/main.yml +3 -0
- data/ansible/roles/geerlingguy.firewall/meta/main.yml +26 -0
- data/ansible/roles/geerlingguy.firewall/molecule/default/molecule.yml +40 -0
- data/ansible/roles/geerlingguy.firewall/molecule/default/playbook.yml +17 -0
- data/ansible/roles/geerlingguy.firewall/molecule/default/tests/test_default.py +14 -0
- data/ansible/roles/geerlingguy.firewall/molecule/default/yaml-lint.yml +6 -0
- data/ansible/roles/geerlingguy.firewall/tasks/disable-other-firewalls.yml +66 -0
- data/ansible/roles/geerlingguy.firewall/tasks/main.yml +44 -0
- data/ansible/roles/geerlingguy.firewall/templates/firewall.bash.j2 +136 -0
- data/ansible/roles/geerlingguy.firewall/templates/firewall.init.j2 +52 -0
- data/ansible/roles/geerlingguy.firewall/templates/firewall.unit.j2 +12 -0
- data/bin/mu-ansible-secret +114 -0
- data/bin/mu-aws-setup +74 -21
- data/bin/mu-node-manage +22 -12
- data/bin/mu-self-update +11 -4
- data/cloud-mu.gemspec +3 -3
- data/cookbooks/firewall/metadata.json +1 -1
- data/cookbooks/firewall/recipes/default.rb +4 -0
- data/cookbooks/mu-master/recipes/default.rb +0 -3
- data/cookbooks/mu-master/recipes/init.rb +15 -9
- data/cookbooks/mu-master/templates/default/mu.rc.erb +1 -1
- data/cookbooks/mu-master/templates/default/web_app.conf.erb +0 -4
- data/cookbooks/mu-php54/metadata.rb +2 -2
- data/cookbooks/mu-php54/recipes/default.rb +1 -3
- data/cookbooks/mu-tools/recipes/eks.rb +25 -2
- data/cookbooks/mu-tools/recipes/nrpe.rb +6 -1
- data/cookbooks/mu-tools/recipes/set_mu_hostname.rb +8 -0
- data/cookbooks/mu-tools/templates/default/etc_hosts.erb +1 -1
- data/cookbooks/mu-tools/templates/default/kubeconfig.erb +2 -2
- data/cookbooks/mu-tools/templates/default/kubelet-config.json.erb +35 -0
- data/extras/clean-stock-amis +10 -4
- data/extras/list-stock-amis +64 -0
- data/extras/python_rpm/build.sh +21 -0
- data/extras/python_rpm/muthon.spec +68 -0
- data/install/README.md +5 -2
- data/install/user-dot-murc.erb +1 -1
- data/modules/mu.rb +52 -8
- data/modules/mu/clouds/aws.rb +1 -1
- data/modules/mu/clouds/aws/container_cluster.rb +1071 -47
- data/modules/mu/clouds/aws/firewall_rule.rb +45 -19
- data/modules/mu/clouds/aws/log.rb +3 -2
- data/modules/mu/clouds/aws/role.rb +18 -2
- data/modules/mu/clouds/aws/server.rb +11 -5
- data/modules/mu/clouds/aws/server_pool.rb +20 -24
- data/modules/mu/clouds/aws/userdata/linux.erb +1 -1
- data/modules/mu/clouds/aws/vpc.rb +9 -0
- data/modules/mu/clouds/google/server.rb +2 -0
- data/modules/mu/config.rb +3 -3
- data/modules/mu/config/container_cluster.rb +1 -1
- data/modules/mu/config/firewall_rule.rb +4 -0
- data/modules/mu/config/role.rb +29 -0
- data/modules/mu/config/server.rb +9 -4
- data/modules/mu/groomer.rb +14 -3
- data/modules/mu/groomers/ansible.rb +553 -0
- data/modules/mu/groomers/chef.rb +0 -5
- data/modules/mu/mommacat.rb +18 -3
- data/modules/scratchpad.erb +1 -1
- data/requirements.txt +5 -0
- metadata +39 -16
@@ -173,7 +173,7 @@ dpkgs = {}
|
|
173
173
|
|
174
174
|
elversion = node['platform_version'].to_i > 2000 ? 6 : node['platform_version'].to_i
|
175
175
|
if platform_family?("rhel")
|
176
|
-
basepackages = ["git", "curl", "diffutils", "patch", "gcc", "gcc-c++", "make", "postgresql-devel", "libyaml", "libffi-devel"]
|
176
|
+
basepackages = ["git", "curl", "diffutils", "patch", "gcc", "gcc-c++", "make", "postgresql-devel", "libyaml", "libffi-devel", "tcl", "tk"]
|
177
177
|
# package epel-release-6-8.9.amzn1.noarch (which is newer than epel-release-6-8.noarch) is already installed
|
178
178
|
|
179
179
|
rpms = {
|
@@ -189,13 +189,15 @@ if platform_family?("rhel")
|
|
189
189
|
elsif elversion < 7
|
190
190
|
basepackages.concat(["mysql-devel"])
|
191
191
|
rpms["ruby25"] = "https://s3.amazonaws.com/cloudamatic/muby-2.5.3-1.el6.x86_64.rpm"
|
192
|
+
rpms["python27"] = "https://s3.amazonaws.com/cloudamatic/muthon-2.7.16-1.el6.x86_64.rpm"
|
192
193
|
|
193
194
|
removepackages = ["nagios"]
|
194
195
|
|
195
196
|
# RHEL7, CentOS7
|
196
197
|
elsif elversion < 8
|
197
|
-
basepackages.concat(["libX11", "
|
198
|
+
basepackages.concat(["libX11", "mariadb-devel", "cryptsetup"])
|
198
199
|
rpms["ruby25"] = "https://s3.amazonaws.com/cloudamatic/muby-2.5.3-1.el7.x86_64.rpm"
|
200
|
+
rpms["python27"] = "https://s3.amazonaws.com/cloudamatic/muthon-2.7.16-1.el7.x86_64.rpm"
|
199
201
|
removepackages = ["nagios", "firewalld"]
|
200
202
|
end
|
201
203
|
# Amazon Linux
|
@@ -284,20 +286,19 @@ end
|
|
284
286
|
# REMOVE OLD RUBYs
|
285
287
|
execute "clean up old Ruby 2.1.6" do
|
286
288
|
command "rm -rf /opt/rubies/ruby-2.1.6"
|
289
|
+
ignore_failure true
|
287
290
|
only_if { ::Dir.exist?("/opt/rubies/ruby-2.1.6") }
|
288
291
|
end
|
289
292
|
|
290
|
-
yum_package 'ruby23-2.3.1-1.el7.centos.x86_64' do
|
291
|
-
action :purge
|
292
|
-
end
|
293
|
-
|
294
293
|
execute "Kill ruby-2.3.1" do
|
295
294
|
command "yum erase ruby23-2.3.1-1.el7.centos.x86_64 -y; rpm -e ruby23"
|
295
|
+
ignore_failure true
|
296
296
|
only_if { ::Dir.exist?("/opt/rubies/ruby-2.3.1") }
|
297
297
|
end
|
298
298
|
|
299
299
|
execute "clean up old ruby-2.3.1" do
|
300
300
|
command "rm -rf /opt/rubies/ruby-2.3.1"
|
301
|
+
ignore_failure true
|
301
302
|
only_if { ::Dir.exist?("/opt/rubies/ruby-2.3.1") }
|
302
303
|
end
|
303
304
|
|
@@ -320,6 +321,7 @@ rpms.each_pair { |pkg, src|
|
|
320
321
|
end
|
321
322
|
end
|
322
323
|
}
|
324
|
+
|
323
325
|
package ["jq"] do
|
324
326
|
ignore_failure true # sometimes we can't see EPEL immediately
|
325
327
|
end
|
@@ -382,6 +384,12 @@ remote_file "#{MU_BASE}/bin/mu-self-update" do
|
|
382
384
|
mode 0755
|
383
385
|
end
|
384
386
|
|
387
|
+
bash "install modules for our built-in Python" do
|
388
|
+
code <<-EOH
|
389
|
+
/usr/local/python-current/bin/pip install -r #{MU_BASE}/lib/requirements.txt
|
390
|
+
EOH
|
391
|
+
end
|
392
|
+
|
385
393
|
["/usr/local/ruby-current", "/opt/chef/embedded"].each { |rubydir|
|
386
394
|
gembin = rubydir+"/bin/gem"
|
387
395
|
gemdir = Dir.glob("#{rubydir}/lib/ruby/gems/?.?.?/gems").last
|
@@ -399,7 +407,6 @@ end
|
|
399
407
|
package_name "bundler"
|
400
408
|
action :upgrade if rubydir == "/usr/local/ruby-current"
|
401
409
|
notifies :run, "bash[fix #{rubydir} gem permissions]", :delayed
|
402
|
-
options('-q --no-documentation')
|
403
410
|
end
|
404
411
|
execute "#{bundler_path} install" do
|
405
412
|
cwd "#{MU_BASE}/lib/modules"
|
@@ -421,7 +428,6 @@ end
|
|
421
428
|
action :remove
|
422
429
|
only_if { ::Dir.exist?(dir) }
|
423
430
|
only_if { ::Dir.exist?(gemdir) }
|
424
|
-
options('-q --no-documentation')
|
425
431
|
end
|
426
432
|
execute "rm -rf #{gemdir}/knife-windows-#{Regexp.last_match[1]}"
|
427
433
|
}
|
@@ -546,7 +552,7 @@ end
|
|
546
552
|
file "#{MU_BASE}/etc/mu.rc" do
|
547
553
|
content %Q{export MU_INSTALLDIR="#{MU_BASE}"
|
548
554
|
export MU_DATADIR="#{MU_BASE}/var"
|
549
|
-
export PATH="#{MU_BASE}/bin:/usr/local/ruby-current/bin:${PATH}:/opt/opscode/embedded/bin"
|
555
|
+
export PATH="#{MU_BASE}/bin:/usr/local/ruby-current/bin:/usr/local/python-current/bin:${PATH}:/opt/opscode/embedded/bin"
|
550
556
|
}
|
551
557
|
mode 0644
|
552
558
|
action :create_if_missing
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# bash/sh environment support for Mu tools. Intended for the system (root)
|
2
2
|
# user. Regular users get a .murc installed by mu-user-manage, from the template
|
3
3
|
# in <%= @installdir %>/lib/install/user-dot-murc.erb
|
4
|
-
export PATH="<%= @installdir %>/bin:/usr/local/ruby-current/bin:${PATH}:/opt/opscode/embedded/bin"
|
4
|
+
export PATH="<%= @installdir %>/bin:/usr/local/ruby-current/bin:/usr/local/python-current/bin:${PATH}:/opt/opscode/embedded/bin"
|
5
5
|
export MU_INSTALLDIR="<%= @installdir %>"
|
6
6
|
export MU_DATADIR="<%= @installdir %>/var"
|
7
7
|
<% if @repos %>
|
@@ -30,10 +30,6 @@
|
|
30
30
|
ProxyPass /scratchpad https://localhost:2260/scratchpad
|
31
31
|
ProxyPassReverse /scratchpad https://localhost:2260/scratchpad
|
32
32
|
|
33
|
-
# Jenkins CI web interface
|
34
|
-
ProxyPass /jenkins http://localhost:8080/jenkins
|
35
|
-
ProxyPassReverse /jenkins http://localhost:8080/jenkins
|
36
|
-
|
37
33
|
# Nagios web UI
|
38
34
|
ProxyPass /nagios/ https://localhost:8443/nagios/
|
39
35
|
ProxyPassReverse /nagios/ https://localhost:8443/nagios/
|
@@ -8,7 +8,7 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
|
8
8
|
source_url 'https://github.com/cloudamatic/mu'
|
9
9
|
issues_url 'https://github.com/cloudamatic/mu/issues'
|
10
10
|
chef_version '>= 14.0' if respond_to?(:chef_version)
|
11
|
-
version '0.3.
|
11
|
+
version '0.3.0'
|
12
12
|
|
13
13
|
%w( centos ubuntu ).each do |os|
|
14
14
|
supports os
|
@@ -18,4 +18,4 @@ depends 'mu-utility'
|
|
18
18
|
depends 'simple_iptables', '~> 0.8.0'
|
19
19
|
depends 'apache2', '< 4.0'
|
20
20
|
depends 'mysql', '~> 8.5.1'
|
21
|
-
depends 'yum-epel', '~> 3.2.0'
|
21
|
+
depends 'yum-epel', '~> 3.2.0'
|
@@ -38,9 +38,7 @@ case node['platform']
|
|
38
38
|
|
39
39
|
# What we really mean is "chef_gem" but that insists on running
|
40
40
|
# at compile time, before any of its dependencies are ready.
|
41
|
-
gem_package "mysql"
|
42
|
-
options('-q --no-documentation')
|
43
|
-
end
|
41
|
+
gem_package "mysql"
|
44
42
|
|
45
43
|
# Sundry libraries for PHP
|
46
44
|
["libmcrypt", "libmcrypt-devel", "php-devel", "php-pdo", "php-mysql", "php-pgsql", "php-gd", "php-pspell", "php-snmp", "php-xmlrpc", "php-xml", "php-mbstring", "php-mcrypt", "php-pear"].each { |pkg|
|
@@ -93,7 +93,7 @@ EOH
|
|
93
93
|
source "https://s3-us-west-2.amazonaws.com/amazon-eks/1.10.3/2018-06-05/eks-2017-11-01.normal.json"
|
94
94
|
end
|
95
95
|
|
96
|
-
execute "aws configure add-model --service-model file
|
96
|
+
execute "aws configure add-model --service-model file:///root/.aws/eks/eks-2017-11-01.normal.json --service-name eks"
|
97
97
|
|
98
98
|
execute "systemctl daemon-reload" do
|
99
99
|
action :nothing
|
@@ -112,10 +112,33 @@ EOH
|
|
112
112
|
notifies :restart, "service[kubelet]", :delayed
|
113
113
|
end
|
114
114
|
|
115
|
+
file "/etc/systemd/system/kubelet.service.d/10-kubelet-args.conf" do
|
116
|
+
content "[Service]
|
117
|
+
Environment='KUBELET_ARGS=--node-ip=#{get_aws_metadata("meta-data/local-ipv4")} --pod-infra-container-image=602401143452.dkr.ecr.#{region}.amazonaws.com/eks/pause-amd64:3.1'"
|
118
|
+
notifies :run, "execute[systemctl daemon-reload]", :immediately
|
119
|
+
notifies :restart, "service[kubelet]", :delayed
|
120
|
+
end
|
121
|
+
|
122
|
+
template "/etc/kubernetes/kubelet/kubelet-config.json" do
|
123
|
+
source "kubelet-config.json.erb"
|
124
|
+
variables(
|
125
|
+
:dns => get_first_nameserver(),
|
126
|
+
)
|
127
|
+
notifies :restart, "service[kubelet]", :delayed
|
128
|
+
end
|
129
|
+
|
130
|
+
file "/etc/systemd/system/kubelet.service.d/30-kubelet-extra-args.conf" do
|
131
|
+
content "[Service]
|
132
|
+
Environment='KUBELET_EXTRA_ARGS=$KUBELET_EXTRA_ARGS'
|
133
|
+
"
|
134
|
+
notifies :restart, "service[kubelet]", :delayed
|
135
|
+
notifies :run, "execute[systemctl daemon-reload]", :immediately
|
136
|
+
end
|
137
|
+
|
115
138
|
directory "/root/.kube"
|
116
139
|
|
117
140
|
remote_file "/usr/bin/aws-iam-authenticator" do
|
118
|
-
source "https://amazon-eks.s3-us-west-2.amazonaws.com/1.
|
141
|
+
source "https://amazon-eks.s3-us-west-2.amazonaws.com/1.12.7/2019-03-27/bin/linux/amd64/aws-iam-authenticator"
|
119
142
|
mode 0755
|
120
143
|
not_if "test -f /usr/bin/aws-iam-authenticator"
|
121
144
|
end
|
@@ -82,7 +82,12 @@ if !node['application_attributes']['skip_recipes'].include?('nrpe')
|
|
82
82
|
service "nrpe" do
|
83
83
|
action [:enable, :start]
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
|
+
# Workaround for Amazon Linux/Chef 14 problem in nrpe cookbook
|
87
|
+
# https://github.com/sous-chefs/nrpe/issues/96
|
88
|
+
node.normal['nrpe']['plugin_dir'] = "/usr/lib64/nagios/plugins"
|
89
|
+
node.save
|
90
|
+
|
86
91
|
nrpe_check "check_disk" do
|
87
92
|
command "#{node['nrpe']['plugin_dir']}/check_disk"
|
88
93
|
warning_condition '15%'
|
@@ -60,6 +60,14 @@ if !node['application_attributes']['skip_recipes'].include?('set_mu_hostname')
|
|
60
60
|
file "/etc/hostname" do
|
61
61
|
content $hostname
|
62
62
|
end
|
63
|
+
elsif node['platform'] == "amazon"
|
64
|
+
file "/etc/hostname" do
|
65
|
+
content $hostname
|
66
|
+
end
|
67
|
+
execute "set hostname" do
|
68
|
+
command "hostname #{$hostname}"
|
69
|
+
not_if "test \"`hostname`\" = \"#{$hostname}\" "
|
70
|
+
end
|
63
71
|
else
|
64
72
|
execute "set hostname" do
|
65
73
|
command "hostname #{$hostname}"
|
@@ -3,10 +3,10 @@ clusters:
|
|
3
3
|
- cluster:
|
4
4
|
server: <%= @endpoint %>
|
5
5
|
certificate-authority-data: <%= @cacert %>
|
6
|
-
name:
|
6
|
+
name: <%= @cluster %>
|
7
7
|
contexts:
|
8
8
|
- context:
|
9
|
-
cluster:
|
9
|
+
cluster: <%= @cluster %>
|
10
10
|
user: aws
|
11
11
|
name: aws
|
12
12
|
current-context: aws
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"kind": "KubeletConfiguration",
|
3
|
+
"apiVersion": "kubelet.config.k8s.io/v1beta1",
|
4
|
+
"address": "0.0.0.0",
|
5
|
+
"clusterDNS": "<%= @dns %>",
|
6
|
+
"authentication": {
|
7
|
+
"anonymous": {
|
8
|
+
"enabled": false
|
9
|
+
},
|
10
|
+
"webhook": {
|
11
|
+
"cacheTTL": "2m0s",
|
12
|
+
"enabled": true
|
13
|
+
},
|
14
|
+
"x509": {
|
15
|
+
"clientCAFile": "/etc/kubernetes/pki/ca.crt"
|
16
|
+
}
|
17
|
+
},
|
18
|
+
"authorization": {
|
19
|
+
"mode": "Webhook",
|
20
|
+
"webhook": {
|
21
|
+
"cacheAuthorizedTTL": "5m0s",
|
22
|
+
"cacheUnauthorizedTTL": "30s"
|
23
|
+
}
|
24
|
+
},
|
25
|
+
"clusterDomain": "cluster.local",
|
26
|
+
"hairpinMode": "hairpin-veth",
|
27
|
+
"cgroupDriver": "cgroupfs",
|
28
|
+
"cgroupRoot": "/",
|
29
|
+
"featureGates": {
|
30
|
+
"RotateKubeletServerCertificate": true
|
31
|
+
},
|
32
|
+
"serializeImagePulls": false,
|
33
|
+
"serverTLSBootstrap": true,
|
34
|
+
"configMapAndSecretChangeDetectionStrategy": "Cache"
|
35
|
+
}
|
data/extras/clean-stock-amis
CHANGED
@@ -18,16 +18,22 @@ require 'json'
|
|
18
18
|
require File.realpath(File.expand_path(File.dirname(__FILE__)+"/../bin/mu-load-config.rb"))
|
19
19
|
require 'mu'
|
20
20
|
|
21
|
+
credentials = if ARGV[0] and !ARGV[0].empty?
|
22
|
+
ARGV[0]
|
23
|
+
else
|
24
|
+
nil
|
25
|
+
end
|
26
|
+
|
21
27
|
filters = [
|
22
28
|
{
|
23
29
|
name: "owner-id",
|
24
|
-
values: [MU.
|
30
|
+
values: [MU::Cloud::AWS.credToAcct(credentials)]
|
25
31
|
}
|
26
32
|
]
|
27
33
|
|
28
34
|
|
29
35
|
MU::Cloud::AWS.listRegions.each { | r|
|
30
|
-
images = MU::Cloud::AWS.ec2(r).describe_images(
|
36
|
+
images = MU::Cloud::AWS.ec2(region: r, credentials: credentials).describe_images(
|
31
37
|
filters: filters + [{ "name" => "state", "values" => ["available"]}]
|
32
38
|
).images
|
33
39
|
images.each { |ami|
|
@@ -39,9 +45,9 @@ MU::Cloud::AWS.listRegions.each { | r|
|
|
39
45
|
end
|
40
46
|
}
|
41
47
|
MU.log "Deregistering #{ami.name} (#{ami.creation_date})", MU::WARN, details: snaps
|
42
|
-
MU::Cloud::AWS.ec2(r).deregister_image(image_id: ami.image_id)
|
48
|
+
MU::Cloud::AWS.ec2(region: r, credentials: credentials).deregister_image(image_id: ami.image_id)
|
43
49
|
snaps.each { |snap_id|
|
44
|
-
MU::Cloud::AWS.ec2(r).delete_snapshot(snapshot_id: snap_id)
|
50
|
+
MU::Cloud::AWS.ec2(region: r, credentials: credentials).delete_snapshot(snapshot_id: snap_id)
|
45
51
|
}
|
46
52
|
end
|
47
53
|
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/local/ruby-current/bin/ruby
|
2
|
+
# Copyright:: Copyright (c) 2019 eGlobalTech, Inc., all rights reserved
|
3
|
+
#
|
4
|
+
# Licensed under the BSD-3 license (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License in the root of the project or at
|
7
|
+
#
|
8
|
+
# http://egt-labs.com/mu/LICENSE.html
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
require 'optimist'
|
17
|
+
require 'json'
|
18
|
+
require 'yaml'
|
19
|
+
require File.realpath(File.expand_path(File.dirname(__FILE__)+"/../bin/mu-load-config.rb"))
|
20
|
+
require 'mu'
|
21
|
+
|
22
|
+
credentials = if ARGV[0] and !ARGV[0].empty?
|
23
|
+
ARGV[0]
|
24
|
+
else
|
25
|
+
nil
|
26
|
+
end
|
27
|
+
|
28
|
+
filters = [
|
29
|
+
{
|
30
|
+
name: "owner-id",
|
31
|
+
values: [MU::Cloud::AWS.credToAcct(credentials)]
|
32
|
+
}
|
33
|
+
]
|
34
|
+
|
35
|
+
platforms = {}
|
36
|
+
|
37
|
+
MU::Cloud::AWS.listRegions.each { | r|
|
38
|
+
images = MU::Cloud::AWS.ec2(region: r, credentials: credentials).describe_images(
|
39
|
+
filters: filters + [{ "name" => "state", "values" => ["available"]}]
|
40
|
+
).images
|
41
|
+
images.each { |ami|
|
42
|
+
if (DateTime.now.to_time - DateTime.parse(ami.creation_date).to_time) < 15552000 and ami.name.match(/^MU-PROD-\d{10}-[A-Z]{2}-(.*)/)
|
43
|
+
platform = Regexp.last_match[1].downcase
|
44
|
+
next if !platform
|
45
|
+
platforms[platform] ||= {}
|
46
|
+
if !platforms[platform][r] or
|
47
|
+
DateTime.parse(ami.creation_date).to_time > platforms[platform][r]['date']
|
48
|
+
platforms[platform][r] = {
|
49
|
+
"date" => DateTime.parse(ami.creation_date).to_time,
|
50
|
+
"ami" => ami.image_id,
|
51
|
+
"name" => ami.name
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
platforms.each_pair { |p, r_data|
|
59
|
+
r_data.each_pair { |r, data|
|
60
|
+
r_data[r] = data["ami"]
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
puts platforms.to_yaml
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
rpm -q rpm-build || yum -y install rpm-build
|
4
|
+
|
5
|
+
base="/opt/mu/lib/extras/python_rpm"
|
6
|
+
|
7
|
+
for d in BUILD BUILDROOT RPMS SOURCES SPECS SRPMS;do
|
8
|
+
mkdir -p ~/rpmbuild/$d
|
9
|
+
done
|
10
|
+
cd ~/rpmbuild
|
11
|
+
|
12
|
+
echo "Temporarily deleting /usr/local/python-current so rpmbuild can create it"
|
13
|
+
link="`readlink /usr/local/python-current`"
|
14
|
+
rm -f /usr/local/python-current
|
15
|
+
chmod 000 /usr/bin/python # otherwise this brain-dead build system tries to compile parts of itself with the wrong executable
|
16
|
+
env -i PATH="/bin:/usr/bin" /usr/bin/rpmbuild -ba $base/muthon.spec
|
17
|
+
chmod 755 /usr/bin/python
|
18
|
+
find ~/rpmbuild/ -type f -name 'muthon*' -exec ls -la {} \;
|
19
|
+
if [ "$link" != "" ];then
|
20
|
+
ln -s "$link" /usr/local/python-current
|
21
|
+
fi
|
@@ -0,0 +1,68 @@
|
|
1
|
+
Summary: Python for Mu
|
2
|
+
BuildArch: x86_64
|
3
|
+
Name: muthon
|
4
|
+
Version: 2.7.16
|
5
|
+
Release: 1%{dist}
|
6
|
+
Group: Development/Languages
|
7
|
+
License: Ruby License/GPL - see COPYING
|
8
|
+
URL: https://www.python.org/
|
9
|
+
Prefix: /opt/pythons
|
10
|
+
Source: https://www.python.org/ftp/python/%{version}/Python-%{version}.tgz
|
11
|
+
|
12
|
+
# auto-require inserts nonsensical things, like a dependency on our own
|
13
|
+
# executable, so I guess we'll declare dependencies by package ourselves
|
14
|
+
AutoReq: no
|
15
|
+
# XXX these don't work for some reason
|
16
|
+
#%global __requires_exclude ^/usr/local/bin/python$
|
17
|
+
#%global __requires_exclude ^/opt/pythons/Python-%{version}/bin/python.*$
|
18
|
+
|
19
|
+
BuildRequires: zlib-devel
|
20
|
+
BuildRequires: tcl-devel
|
21
|
+
BuildRequires: gdbm-devel
|
22
|
+
BuildRequires: openssl-devel
|
23
|
+
BuildRequires: sqlite-devel
|
24
|
+
BuildRequires: tk-devel
|
25
|
+
Requires: zlib
|
26
|
+
Requires: gdbm
|
27
|
+
Requires: tcl
|
28
|
+
Requires: openssl
|
29
|
+
Requires: glibc
|
30
|
+
Requires: ncurses-libs
|
31
|
+
Requires: sqlite
|
32
|
+
Requires: tk
|
33
|
+
|
34
|
+
%description
|
35
|
+
I was sober when I wrote this spec file
|
36
|
+
|
37
|
+
%prep
|
38
|
+
rm -rf $RPM_BUILD_DIR/Python-%{version}
|
39
|
+
rm -rf %{prefix}
|
40
|
+
test -f $RPM_SOURCE_DIR/Python-%{version}.tgz || ( cd $RPM_SOURCE_DIR && curl -O https://www.python.org/ftp/python/%{version}/Python-%{version}.tgz )
|
41
|
+
curl https://bootstrap.pypa.io/get-pip.py -o $RPM_SOURCE_DIR/get-pip.py
|
42
|
+
tar -xzvf $RPM_SOURCE_DIR/Python-%{version}.tgz
|
43
|
+
mkdir -p $RPM_BUILD_ROOT%{prefix}
|
44
|
+
rm -rf $RPM_BUILD_ROOT%{prefix}/Python-%{version}
|
45
|
+
ln -s %{prefix}/Python-%{version} $RPM_BUILD_ROOT%{prefix}/Python-%{version}
|
46
|
+
|
47
|
+
%build
|
48
|
+
cd $RPM_BUILD_DIR/Python-%{version}
|
49
|
+
mkdir -p %{prefix}/Python-%{version}
|
50
|
+
env -i PATH="/bin:/usr/bin" ./configure --prefix=%{prefix}/Python-%{version} --exec-prefix=%{prefix}/Python-%{version} --enable-shared LDFLAGS=-Wl,-rpath=%{prefix}/Python-%{version}/lib
|
51
|
+
env -i PATH="/bin:/usr/bin" make
|
52
|
+
|
53
|
+
%install
|
54
|
+
cd $RPM_BUILD_DIR/Python-%{version}
|
55
|
+
env -i PATH="/bin:/usr/bin" make install
|
56
|
+
%{prefix}/Python-%{version}/bin/python $RPM_SOURCE_DIR/get-pip.py --prefix %{prefix}/Python-%{version}/
|
57
|
+
mkdir -p $RPM_BUILD_ROOT%{prefix}
|
58
|
+
mv %{prefix}/Python-%{version} $RPM_BUILD_ROOT%{prefix}/
|
59
|
+
mkdir -p $RPM_BUILD_ROOT/usr/local/
|
60
|
+
ln -s %{prefix}/Python-%{version} $RPM_BUILD_ROOT/usr/local/python-current
|
61
|
+
|
62
|
+
%clean
|
63
|
+
cd $RPM_BUILD_DIR/Python-%{version}
|
64
|
+
make clean
|
65
|
+
|
66
|
+
%files
|
67
|
+
%{prefix}/Python-%{version}/*
|
68
|
+
/usr/local/python-current
|