aris-control 1.2.1 → 2.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9a61dd46a5d85a26cdaca8ea0e1e06b9cbab795
4
- data.tar.gz: 87daf1c8bd1f7b82d0f425fcc911024a61365ba1
3
+ metadata.gz: af9c164836eceb3181c8ecdbe0918f30529d5199
4
+ data.tar.gz: bd1f1c229729d7997204f606be31d8055be420c6
5
5
  SHA512:
6
- metadata.gz: 0a9ce91d47604d931069a34412636284be00818006bafc560338c422457c51cb77000e4e3ba4695183c5cc433685a5e72c0b42a8bfd19f5f0e6106e7270081be
7
- data.tar.gz: ccc9c11c12d61d0a36ab97ab86d9cccebd264b69dab282cc051276de57eb269df217612881cc032735a88de248f0176881c9de460b2671476aa543aa30b04152
6
+ metadata.gz: d0335338dd9f401d566a4415043b3084961d1d0d4df6b3db7c969b168478d5ed1de7a074a99804ef27982dce4f868691fef8d4a29a5fe894dbb1f32bbced6d37
7
+ data.tar.gz: 7f52e2fb3cab6459391bd88126397a0a925a71afa693c6f343e89a7c77b8770a588c9344604869f80e9421f17f961798c5cd723b9f4fd64044f089e7c8764d6e
@@ -0,0 +1,6 @@
1
+ module ArisControl
2
+ class AnsibleRunner
3
+ def initialize(config = default_config)
4
+ end
5
+ end
6
+ end
@@ -3,30 +3,36 @@ require 'pathname'
3
3
 
4
4
  module ArisControl
5
5
  class Persistence
6
- attr_reader :config_file_path, :users_file_path
6
+ attr_reader :users_file_path
7
7
 
8
- def initialize(config = default_config)
9
- @config = config
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, YAML.dump(users))
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
- YAML.load(IO.binread(users_file_path)) || {}
20
+ deserialized_users(IO.binread(users_file_path))
23
21
  end
24
22
 
25
- def default_config
26
- {
27
- config_file_path: '/opt/aris/config/aris.cfg',
28
- users_file_path: '/opt/aris/config/users.yml',
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ArisControl
2
- VERSION = '1.2.1'
2
+ VERSION = '2.0.0'
3
3
  end
data/lib/aris-control.rb CHANGED
@@ -3,4 +3,5 @@ end
3
3
 
4
4
  require_relative './aris-control/persistence'
5
5
  require_relative './aris-control/bookkeeper'
6
+ require_relative './aris-control/provisioner'
6
7
  require_relative './aris-control/thor'
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: 1.2.1
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-17 00:00:00.000000000 Z
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