aris-control 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aris-control/ansible_runner.rb +6 -0
- data/lib/aris-control/persistence.rb +18 -12
- data/lib/aris-control/provisioner.rb +8 -0
- data/lib/aris-control/thor.rb +10 -0
- data/lib/aris-control/version.rb +1 -1
- data/lib/aris-control.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af9c164836eceb3181c8ecdbe0918f30529d5199
|
4
|
+
data.tar.gz: bd1f1c229729d7997204f606be31d8055be420c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0335338dd9f401d566a4415043b3084961d1d0d4df6b3db7c969b168478d5ed1de7a074a99804ef27982dce4f868691fef8d4a29a5fe894dbb1f32bbced6d37
|
7
|
+
data.tar.gz: 7f52e2fb3cab6459391bd88126397a0a925a71afa693c6f343e89a7c77b8770a588c9344604869f80e9421f17f961798c5cd723b9f4fd64044f089e7c8764d6e
|
@@ -3,30 +3,36 @@ require 'pathname'
|
|
3
3
|
|
4
4
|
module ArisControl
|
5
5
|
class Persistence
|
6
|
-
attr_reader :
|
6
|
+
attr_reader :users_file_path
|
7
7
|
|
8
|
-
def initialize(
|
9
|
-
@
|
10
|
-
@config_file_path = Pathname.new config[:config_file_path]
|
11
|
-
@users_file_path = Pathname.new config[:users_file_path]
|
8
|
+
def initialize(users_file_path = default_users_file_path)
|
9
|
+
@users_file_path = Pathname.new(users_file_path)
|
12
10
|
end
|
13
11
|
|
14
12
|
def store_users(users)
|
15
13
|
users ||= {}
|
16
|
-
IO.binwrite(users_file_path,
|
14
|
+
IO.binwrite(users_file_path, serialized_users(users))
|
17
15
|
users
|
18
16
|
end
|
19
17
|
|
20
18
|
def load_users
|
21
19
|
store_users({}) unless users_file_path.exist?
|
22
|
-
|
20
|
+
deserialized_users(IO.binread(users_file_path))
|
23
21
|
end
|
24
22
|
|
25
|
-
def
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
def default_users_file_path
|
24
|
+
'/opt/aris/config/users.yml'
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def serialized_users(users)
|
30
|
+
YAML.dump({ 'aris_users' => users })
|
31
|
+
end
|
32
|
+
|
33
|
+
def deserialized_users(string)
|
34
|
+
yaml = YAML.load(string) || {}
|
35
|
+
yaml['aris_users'] || {}
|
30
36
|
end
|
31
37
|
end
|
32
38
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module ArisControl
|
2
|
+
class Provisioner
|
3
|
+
def rollout
|
4
|
+
# FIXME: Fetch from config file
|
5
|
+
`/opt/ansible/code/bin/ansible-playbook /opt/aris/code/ansible/playbooks/aris-cron.yml -i /opt/aris/code/ansible/inventories/local.ini --tags=aris-cron-service > /opt/aris/logs/ansible.log`
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
data/lib/aris-control/thor.rb
CHANGED
@@ -31,6 +31,12 @@ class ArisControl::Thor < Thor
|
|
31
31
|
print_current_aris_users
|
32
32
|
end
|
33
33
|
|
34
|
+
desc 'rollout', 'Runs ansible to provision the current users.yml state'
|
35
|
+
def rollout
|
36
|
+
provsioner.rollout
|
37
|
+
print_current_aris_users
|
38
|
+
end
|
39
|
+
|
34
40
|
private
|
35
41
|
|
36
42
|
def print_current_aris_users
|
@@ -42,4 +48,8 @@ class ArisControl::Thor < Thor
|
|
42
48
|
def bookkeeper
|
43
49
|
@bookkeeper ||= ArisControl::Bookkeeper.new
|
44
50
|
end
|
51
|
+
|
52
|
+
def provsioner
|
53
|
+
@provsioner ||= ArisControl::Provisioner.new
|
54
|
+
end
|
45
55
|
end
|
data/lib/aris-control/version.rb
CHANGED
data/lib/aris-control.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aris-control
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Igelmund
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,8 +98,10 @@ files:
|
|
98
98
|
- bin/aris-control
|
99
99
|
- bin/console
|
100
100
|
- lib/aris-control.rb
|
101
|
+
- lib/aris-control/ansible_runner.rb
|
101
102
|
- lib/aris-control/bookkeeper.rb
|
102
103
|
- lib/aris-control/persistence.rb
|
104
|
+
- lib/aris-control/provisioner.rb
|
103
105
|
- lib/aris-control/thor.rb
|
104
106
|
- lib/aris-control/version.rb
|
105
107
|
homepage: https://github.com/grekko/aris-control
|