foreman_ipam 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15b12a3de2a8d9e148cb6fedac4b79ce58e57f2089fdcc2b3d135fb5e5ccdc0b
4
- data.tar.gz: e1eb1ef87928567b1e80701d9076b38120976365a8893b6d94d71ae466d13af8
3
+ metadata.gz: 1e739306ec83e70eb58edf95e5e86f7cba5a2c39cf66249f5d644763d5149b1c
4
+ data.tar.gz: fedbe687ef3cf81a41f2450266b06c9891b08b14c66dde80fe175a1698df2906
5
5
  SHA512:
6
- metadata.gz: fa119451554b2c14c7d7da6e275a9490dce9d7623653865a4c56480848368bc68f1345f70ccf75642920a023c303dbb42353ef6deb83bbc24209522931f324b3
7
- data.tar.gz: f6778feba3af472be59d878a3a3559bd8640c9b489d62c36ed06f73d22992f71081e53da3837dc27f424b9b48e748200f16606dfe370c00ed137165b528eb9cd
6
+ metadata.gz: 2f7a1eebfc19ffb3c85fc085f34feef61c9949811c5f2edf492408c44e69056a30098fda685bd129a2d30ac12b0a94793bf09c8493d841957c62b21abf2d25cf
7
+ data.tar.gz: 2b363b2c2edca37cc29698da4d905e353c1bba49f30320dd511c7fb484d4e49d9149d2ea51fd27dc3e1a0ac79d79999f329159782d8562c2a703b4b589d7f776
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # foreman_ipam
2
2
 
3
- Foreman plugin for IPAM integration with
3
+ Foreman plugin for IPAM integration with various IPAM providers.
4
4
 
5
- Supported Providers:
5
+ Currently supported Providers:
6
6
  1. [phpIPAM](https://phpipam.net/).
7
7
 
8
- Provides a basic UI for viewing phpIPAM sections, subnets and allocated IP addresses. Also allows for obtaining of the next available IPv4 address for a given subnet(via [IPAM Smart Proxy Plugin](https://github.com/grizzthedj/smart_proxy_ipam)).
8
+ Provides a basic Dashboard for viewing phpIPAM sections and subnets. Also allows for obtaining of the next available IPv4 address for a given subnet(via [IPAM Smart Proxy Plugin](https://github.com/grizzthedj/smart_proxy_ipam)).
9
9
 
10
10
  ## Installation
11
11
 
@@ -16,7 +16,7 @@ for how to install Foreman plugins.
16
16
 
17
17
  Once plugin is installed, you can look at the phpIPAM Dashboard(at Infrastructure --> phpIPAM Dashboard), for a simple view of sections, subnets etc. and/or use phpIPAM to get the next available IP address for a subnet:
18
18
 
19
- 1. Create a subnet in Foreman of IPAM type "phpIPAM". Click on the `Proxy` tab and associate the subnet with the phpIPAM proxy. _NOTE: This subnet must actually exist in phpIPAM. There is no phpIPAM integration on the subnet creation at this time._
19
+ 1. Create a subnet in Foreman of IPAM type "IPAM". Click on the `Proxy` tab and associate the subnet with the IPAM proxy. _NOTE: This subnet must actually exist in phpIPAM. There is no phpIPAM integration on the subnet creation at this time._
20
20
  2. Create a host in Foreman. When adding/editing interfaces, select the above subnet, and the next available IP(pulled from phpIPAM) for the selected subnet will be displayed in the IPv4 address field. _NOTE: This is not supported for IPv6._
21
21
 
22
22
  ## Local development
@@ -64,6 +64,14 @@ bundle exec smart-proxy start
64
64
  11. Ensure that the `phpipam` feature is present on the proxy(http://proxy_url/features)
65
65
  12. Create a Subnet, and associate the subnet to the `phpipam` proxy
66
66
 
67
+ ## Run tests
68
+
69
+ From the Foreman core, run ...
70
+
71
+ ```
72
+ bundle exec rails test:foreman_ipam
73
+ ```
74
+
67
75
  ## TODO
68
76
 
69
77
  - Support for ip ranges
data/Rakefile CHANGED
@@ -20,8 +20,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
23
- APP_RAKEFILE = File.expand_path('../test/dummy/Rakefile', __FILE__)
24
-
25
23
  Bundler::GemHelper.install_tasks
26
24
 
27
25
  require 'rake/testtask'
@@ -35,13 +33,13 @@ end
35
33
 
36
34
  task default: :test
37
35
 
38
- begin
39
- require 'rubocop/rake_task'
40
- RuboCop::RakeTask.new
41
- rescue => _
42
- puts 'Rubocop not loaded.'
43
- end
36
+ # begin
37
+ # require 'rubocop/rake_task'
38
+ # RuboCop::RakeTask.new
39
+ # rescue => _
40
+ # puts 'Rubocop not loaded.'
41
+ # end
44
42
 
45
- task :default do
46
- Rake::Task['rubocop'].execute
47
- end
43
+ # task :default do
44
+ # Rake::Task['rubocop'].execute
45
+ # end
@@ -2,13 +2,12 @@
2
2
  module ForemanIpam
3
3
  class DashboardController < ::DashboardController
4
4
  def ipam
5
- @response = PhpipamClient.proxy.get_sections
5
+ @response = Phpipam.proxy.get_sections
6
6
  end
7
7
 
8
8
  def subnets
9
- @subnets = PhpipamClient.proxy.get_subnets(params[:section_id])
9
+ @subnets = Phpipam.proxy.get_subnets(params[:section_id])
10
10
  render :json => @subnets.to_json, :status => :ok
11
11
  end
12
12
  end
13
13
  end
14
-
@@ -2,12 +2,12 @@ module ForemanIpam
2
2
  module DashboardHelperExtensions
3
3
  extend ActiveSupport::Concern
4
4
 
5
- included do
6
- # execute callbacks
7
- end
5
+ # included do
6
+ # # execute callbacks
7
+ # end
8
8
 
9
- # create or overwrite instance methods...
10
- def instance_method_name
11
- end
9
+ # # create or overwrite instance methods...
10
+ # def instance_method_name
11
+ # end
12
12
  end
13
13
  end
@@ -2,18 +2,18 @@ module ForemanIpam
2
2
  module DashboardExtensions
3
3
  extend ActiveSupport::Concern
4
4
 
5
- included do
6
- # execute callbacks
7
- end
5
+ # included do
6
+ # # execute callbacks
7
+ # end
8
8
 
9
- # create or overwrite instance methods...
10
- def instance_method_name
11
- end
9
+ # # create or overwrite instance methods...
10
+ # def instance_method_name
11
+ # end
12
12
 
13
- module ClassMethods
14
- # create or overwrite class methods...
15
- def class_method_name
16
- end
17
- end
13
+ # module ClassMethods
14
+ # # create or overwrite class methods...
15
+ # def class_method_name
16
+ # end
17
+ # end
18
18
  end
19
19
  end
@@ -1,6 +1,6 @@
1
1
  <h1>IPAM Integration Dashboard</h1>
2
2
 
3
- <% if @response %>
3
+ <% if @response && @response.length > 0 %>
4
4
  <h2>phpIPAM</h2>
5
5
  <h3>Sections:</h3>
6
6
  <table class="<%= table_css_classes 'table-fixed' %>">
@@ -26,7 +26,7 @@
26
26
  <% else %>
27
27
  <div class="alert alert-warning ">
28
28
  <span class="pficon pficon-warning-triangle-o "></span>
29
- <span class="text"><%= _("No sections found in the phpIPAM instance.") %></span>
29
+ <span class="text"><%= _("No sections found in the External IPAM instance.") %></span>
30
30
  </div>
31
31
  <% end %>
32
32
 
@@ -50,7 +50,7 @@
50
50
  }
51
51
 
52
52
  function displaySubnets(data) {
53
- var subnets = data['data'];
53
+ var subnets = data;
54
54
  subnet_container.innerHTML += `
55
55
  <div class='col-md-2'><strong>Subnet</strong></div>
56
56
  <div class='col-md-6'><strong>Description</strong></strong></div><br />
@@ -1 +1 @@
1
- require_relative '../../lib/foreman_ipam/phpipam_client'
1
+ require_relative '../../lib/foreman_ipam/phpipam'
@@ -1,6 +1,5 @@
1
-
2
1
  module ForemanIpam
3
- class PhpipamClient
2
+ class Phpipam
4
3
  def self.proxy
5
4
  external_ipam_proxy = SmartProxy.with_features('external_ipam').first
6
5
  ProxyAPI::ExternalIpam.new({:url => external_ipam_proxy[:url]})
@@ -1,3 +1,3 @@
1
1
  module ForemanIpam
2
- VERSION = '0.0.3'.freeze
2
+ VERSION = '0.0.4'.freeze
3
3
  end
@@ -1,5 +1,5 @@
1
1
  FactoryBot.define do
2
- factory :host do
3
- name 'foreman_ipam'
4
- end
2
+ # factory :host do
3
+ # name 'foreman_ipam'
4
+ # end
5
5
  end
@@ -0,0 +1,8 @@
1
+ require 'test_plugin_helper'
2
+
3
+ class ForemanIpamTest < ActiveSupport::TestCase
4
+ test 'ensure proxy responds correctly to has_feature?' do
5
+ proxy = FactoryBot.build(:ipam_smart_proxy)
6
+ assert proxy.has_feature?('External IPAM')
7
+ end
8
+ end
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_ipam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-11 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rubocop
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rdoc
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0'
11
+ date: 2019-07-10 00:00:00.000000000 Z
12
+ dependencies: []
41
13
  description: Plugin for IPAM integration with various IPAM providers
42
14
  email:
43
15
  - chrisjsmith001@gmail.com
@@ -59,7 +31,7 @@ files:
59
31
  - db/seeds.d/01-add-external-ipam-feature.rb
60
32
  - lib/foreman_ipam.rb
61
33
  - lib/foreman_ipam/engine.rb
62
- - lib/foreman_ipam/phpipam_client.rb
34
+ - lib/foreman_ipam/phpipam.rb
63
35
  - lib/foreman_ipam/version.rb
64
36
  - lib/tasks/foreman_ipam_tasks.rake
65
37
  - locale/Makefile
@@ -68,8 +40,8 @@ files:
68
40
  - locale/gemspec.rb
69
41
  - test/factories/foreman_ipam_factories.rb
70
42
  - test/test_plugin_helper.rb
71
- - test/unit/foreman_phpipam_test.rb
72
- homepage: https://github.com/grizzthedj
43
+ - test/unit/foreman_ipam_test.rb
44
+ homepage: https://github.com/grizzthedj/foreman_ipam
73
45
  licenses:
74
46
  - GPL-3.0
75
47
  metadata: {}
@@ -94,6 +66,6 @@ signing_key:
94
66
  specification_version: 4
95
67
  summary: Plugin for IPAM integration with various IPAM providers
96
68
  test_files:
97
- - test/unit/foreman_phpipam_test.rb
69
+ - test/unit/foreman_ipam_test.rb
98
70
  - test/factories/foreman_ipam_factories.rb
99
71
  - test/test_plugin_helper.rb
@@ -1,11 +0,0 @@
1
- require 'test_plugin_helper'
2
-
3
- class ForemanIpamTest < ActiveSupport::TestCase
4
- setup do
5
- User.current = User.find_by_login 'admin'
6
- end
7
-
8
- test 'the truth' do
9
- assert true
10
- end
11
- end