Skip to content

Commit

Permalink
M #-: minor changes in provision (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Huertas Herrero committed Jan 20, 2021
1 parent 0df9ee4 commit aafdf3d
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 128 deletions.
21 changes: 8 additions & 13 deletions src/cli/oneprovision
Expand Up @@ -19,20 +19,15 @@
ONE_LOCATION = ENV['ONE_LOCATION']

if !ONE_LOCATION
LIB_LOCATION = '/usr/lib/one'
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
GEMS_LOCATION = '/usr/share/one/gems'
REMOTES_LOCATION = '/var/lib/one/remotes'
ANSIBLE_LOCATION = '/usr/share/one/oneprovision/ansible'
PROVIDERS_LOCATION = '/usr/lib/one/oneprovision/lib/terraform/providers'
LIB_LOCATION = '/usr/lib/one'
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
GEMS_LOCATION = '/usr/share/one/gems'
REMOTES_LOCATION = '/var/lib/one/remotes'
else
LIB_LOCATION = ONE_LOCATION + '/lib'
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
REMOTES_LOCATION = ONE_LOCATION + '/var/remotes'
ANSIBLE_LOCATION = ONE_LOCATION + '/share/oneprovision/ansible'
PROVIDERS_LOCATION = ONE_LOCATION +
'/lib/oneprovision/lib/terraform/providers'
LIB_LOCATION = ONE_LOCATION + '/lib'
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
REMOTES_LOCATION = ONE_LOCATION + '/var/remotes'
end

if File.directory?(GEMS_LOCATION)
Expand Down
2 changes: 0 additions & 2 deletions src/cli/oneprovision-template
Expand Up @@ -23,13 +23,11 @@ if !ONE_LOCATION
RUBY_LIB_LOCATION = '/usr/lib/one/ruby'
GEMS_LOCATION = '/usr/share/one/gems'
REMOTES_LOCATION = '/var/lib/one/remotes'
ANSIBLE_LOCATION = '/usr/share/one/oneprovision/ansible'
else
LIB_LOCATION = ONE_LOCATION + '/lib'
RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby'
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
REMOTES_LOCATION = ONE_LOCATION + '/var/remotes'
ANSIBLE_LOCATION = ONE_LOCATION + '/share/oneprovision/ansible'
end

if File.directory?(GEMS_LOCATION)
Expand Down
61 changes: 0 additions & 61 deletions src/oneprovision/etc/packet_driver.conf

This file was deleted.

52 changes: 0 additions & 52 deletions src/oneprovision/etc/packet_plans.rb

This file was deleted.

6 changes: 6 additions & 0 deletions src/oneprovision/lib/provision/ansible.rb
Expand Up @@ -23,6 +23,12 @@
require 'erb'
require 'ostruct'

if !ONE_LOCATION
ANSIBLE_LOCATION = '/usr/share/one/oneprovision/ansible'
else
ANSIBLE_LOCATION = ONE_LOCATION + '/share/oneprovision/ansible'
end

# Default provision parameters
CONFIG_DEFAULTS = {
'connection' => {
Expand Down
2 changes: 2 additions & 0 deletions src/oneprovision/lib/provision/provision.rb
Expand Up @@ -197,6 +197,8 @@ def info_objects(object, update = false)
path = 'resource'
end

return [] unless @body['provision'][path][object]

resource = Resource.object(object)

@body['provision'][path][object].each do |o|
Expand Down
7 changes: 7 additions & 0 deletions src/oneprovision/lib/terraform/terraform.rb
Expand Up @@ -19,6 +19,13 @@
require 'yaml'
require 'zlib'

if !ONE_LOCATION
PROVIDERS_LOCATION = '/usr/lib/one/oneprovision/lib/terraform/providers'
else
PROVIDERS_LOCATION = ONE_LOCATION +
'/lib/oneprovision/lib/terraform/providers'
end

# Module OneProvision
module OneProvision

Expand Down

0 comments on commit aafdf3d

Please sign in to comment.