opswalrus 1.0.27 → 1.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/opswalrus/bootstrap.sh +105 -24
- data/lib/opswalrus/host.rb +5 -1
- data/lib/opswalrus/ops_file_script.rb +7 -0
- data/lib/opswalrus/ops_file_script_dsl.rb +2 -2
- data/lib/opswalrus/runtime_environment.rb +2 -0
- data/lib/opswalrus/version.rb +1 -1
- data/lib/opswalrus/walrus_lang.rb +7 -1
- data/vms/web-fedora/Vagrantfile +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95be80c5fc4ff5b54b579adbf681ae134f9f1e32ebfee9ee5654da294a6ee4ec
|
4
|
+
data.tar.gz: 7443c58118a65cb8643093de761a74c97f6f86c8f134a403d06f7864a26e156a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71d5e41176f93c0d01f07ff2c893de09b81776d1068bab235343b2cfb283c1bf7725cb1f64baf99762f93cef0a64a3817ff9f460cdb1b23f634f7f77aee9aaa0
|
7
|
+
data.tar.gz: 59aa3c3fb801afa462c83dbef214b2b4baba528924b1fc1f194ce792b212c762f991f5c89df7fd316e95a6875f8aef661168384145130bfe6723181b01ff5604
|
data/Gemfile.lock
CHANGED
data/lib/opswalrus/bootstrap.sh
CHANGED
@@ -1,19 +1,37 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
3
|
+
export PATH="$HOME/.local/share/rtx/bin:$PATH" # this is key for activating rtx without running `eval "$($RTX activate bash)"`
|
4
|
+
RTX="$HOME/.local/share/rtx/bin/rtx"
|
5
|
+
rtx_init() { eval "$($RTX activate bash)"; }
|
6
|
+
# RTX_RUBY="$HOME/.local/share/rtx/bin/rtx x ruby -- ruby"
|
7
|
+
# RTX_GEM="$HOME/.local/share/rtx/bin/rtx x ruby -- gem"
|
8
|
+
RTX_RUBY="$HOME/.local/share/rtx/shims/ruby"
|
9
|
+
RTX_GEM="$HOME/.local/share/rtx/shims/gem"
|
10
|
+
RUBY_CMD=$RTX_RUBY
|
11
|
+
GEM_CMD=$RTX_GEM
|
12
|
+
# RUBY_CMD="ruby"
|
13
|
+
# GEM_CMD="gem"
|
14
|
+
|
15
|
+
if [ -x $RTX ]; then
|
16
|
+
# rtx_init;
|
17
|
+
# eval "$($RTX activate bash)"
|
18
|
+
# if brew is already installed, initialize this shell environment with brew
|
19
|
+
# if [ -x "$(command -v /home/linuxbrew/.linuxbrew/bin/brew)" ]; then
|
20
|
+
if $RUBY_CMD -e "major, minor, patch = RUBY_VERSION.split('.'); exit 1 unless major.to_i >= 3"; then
|
21
|
+
# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
22
|
+
|
23
|
+
# exit early if ruby already exists
|
24
|
+
# if [ -x "$(command -v $HOME/.rubies/ruby-3.2.2/bin/ruby)" ]; then
|
25
|
+
echo 'Ruby is already installed.'
|
26
|
+
|
27
|
+
# make sure the latest opswalrus gem is installed
|
28
|
+
# todo: figure out how to install this differently, so that test versions will work
|
29
|
+
# gem install opswalrus
|
30
|
+
$GEM_CMD install opswalrus
|
31
|
+
$RTX reshim
|
32
|
+
|
33
|
+
exit 0
|
34
|
+
# fi
|
17
35
|
fi
|
18
36
|
fi
|
19
37
|
|
@@ -42,7 +60,7 @@ elif echo $OS | grep -q 'fedora'; then
|
|
42
60
|
sudo dnf groupinstall -y 'Development Tools'
|
43
61
|
sudo dnf -yq install procps-ng curl file git
|
44
62
|
elif echo $OS | grep -q 'arch'; then
|
45
|
-
sudo pacman -Syu --noconfirm base-devel procps-ng curl file git
|
63
|
+
sudo pacman -Syu --noconfirm --needed base-devel procps-ng curl file git
|
46
64
|
else
|
47
65
|
echo "unsupported OS"
|
48
66
|
exit 1
|
@@ -50,14 +68,15 @@ fi
|
|
50
68
|
|
51
69
|
|
52
70
|
# install homebrew
|
53
|
-
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
71
|
+
# NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
54
72
|
|
55
73
|
# initialize brew in shell session
|
56
|
-
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
74
|
+
# eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
75
|
+
|
76
|
+
# install gcc, age
|
77
|
+
# brew install gcc
|
78
|
+
# brew install age # https://github.com/FiloSottile/age
|
57
79
|
|
58
|
-
# install gcc, ruby, age
|
59
|
-
brew install gcc
|
60
|
-
brew install age # https://github.com/FiloSottile/age
|
61
80
|
|
62
81
|
### install ruby
|
63
82
|
|
@@ -67,14 +86,76 @@ brew install age # https://github.com/FiloSottile/age
|
|
67
86
|
|
68
87
|
# 2. via ruby-install
|
69
88
|
# brew install bash grep wget curl md5sha1sum sha2 gnu-tar bzip2 xz patchutils gcc
|
70
|
-
brew install ruby-install
|
71
|
-
ruby-install --update
|
72
|
-
ruby-install ruby 3.2.2
|
89
|
+
# brew install ruby-install
|
90
|
+
# ruby-install --update
|
91
|
+
# ruby-install ruby 3.2.2
|
73
92
|
|
74
93
|
# 3. rvm
|
75
94
|
# gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
76
95
|
# \curl -sSL https://get.rvm.io | bash -s stable --autolibs=homebrew
|
77
96
|
# rvm install 3.2.2
|
78
97
|
|
98
|
+
# 4. rtx (asdf clone)
|
99
|
+
if echo $OS | grep -q 'ubuntu'; then
|
100
|
+
# update package list
|
101
|
+
sudo apt update -qy
|
102
|
+
|
103
|
+
if [ -f /var/run/reboot-required ]; then
|
104
|
+
echo 'A system reboot is required!'
|
105
|
+
exit 1
|
106
|
+
fi
|
107
|
+
|
108
|
+
# install ruby dependencies
|
109
|
+
# see https://github.com/rbenv/ruby-build/wiki#suggested-build-environment
|
110
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq libgdbm6
|
111
|
+
if [ $? -ne 0 ]; then
|
112
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq libgdbm5
|
113
|
+
fi
|
114
|
+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq autoconf patch build-essential rustc libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libgmp-dev libncurses5-dev libffi-dev libgdbm-dev libdb-dev uuid-dev
|
115
|
+
|
116
|
+
# restart services that need it
|
117
|
+
sudo needrestart -q -r a
|
118
|
+
sudo needrestart -q -r a
|
119
|
+
sudo needrestart -q -r a
|
120
|
+
elif echo $OS | grep -q 'fedora'; then
|
121
|
+
# from https://github.com/rbenv/ruby-build/wiki#suggested-build-environment
|
122
|
+
sudo yum install -y gcc patch bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel
|
123
|
+
elif echo $OS | grep -q 'arch'; then
|
124
|
+
# from https://github.com/rbenv/ruby-build/wiki#suggested-build-environment
|
125
|
+
sudo pacman -Syu --noconfirm --needed base-devel rust libffi libyaml openssl zlib
|
126
|
+
else
|
127
|
+
echo "unsupported OS"
|
128
|
+
exit 1
|
129
|
+
fi
|
130
|
+
curl https://rtx.pub/install.sh | sh
|
131
|
+
# eval "$($HOME/.local/share/rtx/bin/rtx activate bash)"
|
132
|
+
$RTX use -g ruby@3.2
|
133
|
+
$RTX reshim
|
134
|
+
|
135
|
+
|
136
|
+
# 5. age
|
137
|
+
if echo $OS | grep -q 'ubuntu'; then
|
138
|
+
# update package list
|
139
|
+
sudo apt update -qy
|
140
|
+
|
141
|
+
if [ -f /var/run/reboot-required ]; then
|
142
|
+
echo 'A system reboot is required!'
|
143
|
+
exit 1
|
144
|
+
fi
|
145
|
+
|
146
|
+
sudo DEBIAN_FRONTEND=noninteractive apt install -yq age
|
147
|
+
|
148
|
+
# restart services that need it
|
149
|
+
sudo needrestart -q -r a
|
150
|
+
elif echo $OS | grep -q 'fedora'; then
|
151
|
+
sudo dnf -yq install age
|
152
|
+
elif echo $OS | grep -q 'arch'; then
|
153
|
+
sudo pacman -Syu --noconfirm --needed age
|
154
|
+
else
|
155
|
+
echo "unsupported OS"
|
156
|
+
exit 1
|
157
|
+
fi
|
158
|
+
|
79
159
|
# install opswalrus gem
|
80
|
-
$
|
160
|
+
$GEM_CMD install opswalrus
|
161
|
+
$RTX reshim
|
data/lib/opswalrus/host.rb
CHANGED
@@ -6,6 +6,9 @@ require_relative "invocation"
|
|
6
6
|
|
7
7
|
module OpsWalrus
|
8
8
|
|
9
|
+
OPS_GEM="$HOME/.local/share/rtx/shims/gem"
|
10
|
+
OPS_CMD="$HOME/.local/share/rtx/shims/ops"
|
11
|
+
|
9
12
|
# the subclasses of HostProxy will define methods that handle method dispatch via HostProxyOpsFileInvocationBuilder objects
|
10
13
|
class HostProxy
|
11
14
|
|
@@ -188,7 +191,8 @@ module OpsWalrus
|
|
188
191
|
end
|
189
192
|
|
190
193
|
# cmd = "OPSWALRUS_LOCAL_HOSTNAME='#{local_hostname_for_remote_host}'; /home/linuxbrew/.linuxbrew/bin/gem exec --conservative -g opswalrus ops"
|
191
|
-
cmd = "OPSWALRUS_LOCAL_HOSTNAME='#{local_hostname_for_remote_host}'; $
|
194
|
+
# cmd = "OPS_GEM=\"#{OPS_GEM}\" OPSWALRUS_LOCAL_HOSTNAME='#{local_hostname_for_remote_host}'; $OPS_GEM exec --conservative -g opswalrus ops"
|
195
|
+
cmd = "OPSWALRUS_LOCAL_HOSTNAME='#{local_hostname_for_remote_host}'; #{OPS_CMD}"
|
192
196
|
cmd << " -v" if verbose
|
193
197
|
cmd << " #{ops_command.to_s}"
|
194
198
|
cmd << " #{ops_command_options.to_s}" if ops_command_options
|
@@ -75,6 +75,13 @@ module OpsWalrus
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
class EnvParams < InvocationParams
|
79
|
+
# params : Hash | ArrayOrHashNavigationProxy
|
80
|
+
def initialize(hashlike_params = ENV)
|
81
|
+
super(hashlike_params)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
78
85
|
class OpsFileScript
|
79
86
|
|
80
87
|
def self.define_for(ops_file, ruby_script)
|
@@ -234,9 +234,11 @@ module OpsWalrus
|
|
234
234
|
|
235
235
|
attr_accessor :app
|
236
236
|
attr_accessor :pty
|
237
|
+
attr_reader :env
|
237
238
|
|
238
239
|
def initialize(app)
|
239
240
|
@app = app
|
241
|
+
@env = EnvParams.new(ENV)
|
240
242
|
@bundle_load_path = LoadPath.new(self, @app.bundle_dir)
|
241
243
|
@app_load_path = LoadPath.new(self, @app.pwd)
|
242
244
|
|
data/lib/opswalrus/version.rb
CHANGED
@@ -63,6 +63,12 @@ module WalrusLang
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
class String
|
67
|
+
def render_template(hash)
|
68
|
+
WalrusLang.render(self, hash)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
66
72
|
class Hash
|
67
73
|
def to_binding
|
68
74
|
OpenStruct.new(self).instance_eval { binding }
|
@@ -77,7 +83,7 @@ end
|
|
77
83
|
|
78
84
|
def mustache(&block)
|
79
85
|
template_string = block.call
|
80
|
-
template_string =~ /{{.*}}/ ? WalrusLang.render(
|
86
|
+
template_string =~ /{{.*}}/ ? WalrusLang.render(template_string, block.binding) : template_string
|
81
87
|
end
|
82
88
|
|
83
89
|
|
data/vms/web-fedora/Vagrantfile
CHANGED
@@ -29,6 +29,9 @@ Vagrant.configure("2") do |config|
|
|
29
29
|
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
|
30
30
|
# documentation for more information about their specific syntax and use.
|
31
31
|
config.vm.provision "shell", inline: <<-SHELL
|
32
|
+
echo "tmpfs /tmp tmpfs rw,nodev,nosuid,size=5G 0 0" | sudo tee -a /etc/fstab
|
33
|
+
|
34
|
+
# this helps to address the issue where new builds of fedora do not honor the vagrant network config settings
|
32
35
|
sudo dnf install -yq NetworkManager-initscripts-ifcfg-rh
|
33
36
|
|
34
37
|
# this migrates the old network management config to the new style
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opswalrus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Ellis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|