obs_deploy 0.1.5.1 → 0.2.0
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/README.md +18 -4
- data/dist/_service +4 -0
- data/dist/rubygem-obs_deploy.spec +1 -1
- data/lib/obs_deploy/cli/commands/deploy.rb +3 -3
- data/lib/obs_deploy/ssh.rb +31 -4
- data/lib/obs_deploy/version.rb +1 -1
- data/lib/obs_deploy/zypper.rb +16 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a671e53bbfc49281a52dfc32edc85bf74dddb20fd45034a6f3118aa60cd7693e
|
4
|
+
data.tar.gz: e8a2fa4883c4a2f182593c8c9b3bb2e4b02918047b6b5f3c6057520b963404c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 580a4c94c6769d977de4c1b91f40cf86f355e31c26027761ea24ebc82c0ba2c14cfe2161c4c36fa7b8c385fd4464bceb0dc766cc42a5e2c1c4736b52983e9a2d
|
7
|
+
data.tar.gz: 57dc7ee60f649e8a344d368d86d201001605a128319396319f833a170a3b0dbd545f96acf8e38279c33ea5b1bc77077aaf7c6ed139ecbedb024d5e2867a5c2aa
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Simple tool to deploy OBS via zypper to our reference server
|
4
4
|
|
5
|
+
## Build Status
|
6
|
+
[![CircleCI](https://circleci.com/gh/vpereira/obs_deploy.svg?style=svg)](https://app.circleci.com/pipelines/github/vpereira/obs_deploy)
|
7
|
+
|
8
|
+
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
Just run:
|
@@ -23,8 +27,22 @@ zypper in ruby2.6-rubygem-obs_deploy
|
|
23
27
|
|
24
28
|
### To deploy
|
25
29
|
|
30
|
+
As default it will run in `dry-run` mode (no changes are made)
|
31
|
+
|
32
|
+
#### dry-run:
|
33
|
+
|
26
34
|
`obs_deploy deploy --user root --host localhost`
|
27
35
|
|
36
|
+
or
|
37
|
+
|
38
|
+
`obs_deploy deploy --user root --host localhost --dry-run`
|
39
|
+
|
40
|
+
### deploy
|
41
|
+
|
42
|
+
`obs_deploy deploy --user root --host localhost --no-dry-run`
|
43
|
+
|
44
|
+
|
45
|
+
|
28
46
|
### To check which version is deployed
|
29
47
|
|
30
48
|
`obs_deploy deployed-version [--host <server>]`
|
@@ -33,10 +51,6 @@ zypper in ruby2.6-rubygem-obs_deploy
|
|
33
51
|
|
34
52
|
`obs_deploy available-package [<product>] [<package-name>]`
|
35
53
|
|
36
|
-
### Deploy dry-run
|
37
|
-
|
38
|
-
`obs_deploy deploy --user root --host localhost --dry-run`
|
39
|
-
|
40
54
|
### Refresh Zypper repositories
|
41
55
|
|
42
56
|
`obs_deploy refresh-repositories`
|
data/dist/_service
ADDED
@@ -7,14 +7,14 @@ module ObsDeploy
|
|
7
7
|
desc 'Deploy obs-api'
|
8
8
|
|
9
9
|
option :user, type: :string, default: 'root', desc: 'User'
|
10
|
-
option :dry_run, type: :
|
10
|
+
option :dry_run, type: :boolean, default: true, desc: 'Dry run'
|
11
11
|
option :host, type: :string, default: 'localhost', desc: 'Set the server address'
|
12
12
|
option :port, type: :int, default: 22, desc: 'Set the server port'
|
13
13
|
|
14
14
|
def call(user:, dry_run:, host:, port:, **)
|
15
15
|
ssh_driver = ObsDeploy::SSH.new(user: user, server: host, port: port)
|
16
|
-
zypper = ObsDeploy::Zypper.new
|
17
|
-
ssh_driver.run(zypper.update
|
16
|
+
zypper = ObsDeploy::Zypper.new(dry_run: dry_run)
|
17
|
+
ssh_driver.run(zypper.update)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
data/lib/obs_deploy/ssh.rb
CHANGED
@@ -13,21 +13,48 @@ module ObsDeploy
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def build_command
|
16
|
-
|
17
|
-
command_line << ['-i', @identity_file] if @identity_file
|
18
|
-
['ssh'] + command_line.flatten
|
16
|
+
['ssh'] + basic_connection_string + identity + ssh_port
|
19
17
|
end
|
20
18
|
|
21
19
|
def run(cmd)
|
22
20
|
Cheetah.run(build_command + cmd, logger: logger)
|
23
21
|
end
|
24
22
|
|
23
|
+
private
|
24
|
+
|
25
|
+
# -t Force pseudo-tty allocation.
|
26
|
+
# This can be used to execute arbitrary screen-based programs on a
|
27
|
+
# remote machine, which can be very useful, e.g. when implementing menu services.
|
28
|
+
# Multiple -t
|
29
|
+
# options force tty allocation, even if ssh has no local tty.
|
30
|
+
def ssh_tt
|
31
|
+
['-tt']
|
32
|
+
end
|
33
|
+
|
34
|
+
def identity
|
35
|
+
@identity_file ? ['-i', @identity_file] : []
|
36
|
+
end
|
37
|
+
|
38
|
+
def basic_connection_string
|
39
|
+
ssh_tt + [[@user, '@', @server].join]
|
40
|
+
end
|
41
|
+
|
42
|
+
def ssh_port
|
43
|
+
@port && @port != 22 ? ['-p', @port.to_s] : []
|
44
|
+
end
|
45
|
+
|
25
46
|
def logger
|
26
|
-
Logger.new(STDOUT, level: logger_level)
|
47
|
+
Logger.new(STDOUT, level: logger_level, formatter: logger_formatter)
|
27
48
|
end
|
28
49
|
|
29
50
|
def logger_level
|
30
51
|
@debug ? Logger::DEBUG : Logger::INFO
|
31
52
|
end
|
53
|
+
|
54
|
+
def logger_formatter
|
55
|
+
proc do |severity, datetime, progname, msg|
|
56
|
+
"#{severity} - #{msg}\n"
|
57
|
+
end
|
58
|
+
end
|
32
59
|
end
|
33
60
|
end
|
data/lib/obs_deploy/version.rb
CHANGED
data/lib/obs_deploy/zypper.rb
CHANGED
@@ -2,12 +2,14 @@
|
|
2
2
|
|
3
3
|
module ObsDeploy
|
4
4
|
class Zypper
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
attr_accessor :dry_run
|
6
|
+
|
7
|
+
def initialize(dry_run: true, package_name: 'obs-api')
|
8
|
+
@dry_run = dry_run
|
9
|
+
end
|
10
|
+
|
11
|
+
def update
|
12
|
+
run ['zypper'] + update_string + package_name
|
11
13
|
end
|
12
14
|
|
13
15
|
def refresh
|
@@ -20,6 +22,14 @@ module ObsDeploy
|
|
20
22
|
params
|
21
23
|
end
|
22
24
|
|
25
|
+
def update_string
|
26
|
+
if @dry_run
|
27
|
+
update_params + dry_run_params
|
28
|
+
else
|
29
|
+
update_params
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
23
33
|
def package_name
|
24
34
|
['obs-api']
|
25
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: obs_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pereira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- bin/obs_deploy
|
160
160
|
- bin/setup
|
161
161
|
- dist/Makefile
|
162
|
+
- dist/_service
|
162
163
|
- dist/rubygem-obs_deploy.spec
|
163
164
|
- entrypoint.sh
|
164
165
|
- lib/obs_deploy.rb
|