Revert "Adds ability to configure ODL user/pass" 64/56864/3
authorDaniel Farrell <dfarrell@redhat.com>
Thu, 11 May 2017 14:28:43 +0000 (10:28 -0400)
committerDaniel Farrell <dfarrell@redhat.com>
Thu, 11 May 2017 15:13:56 +0000 (15:13 +0000)
Not supported in Boron, removing from stable/boron banch.

The JAR this used to change ODL's user/pass isn't in Boron and will not
be added in an SR.

This reverts commit 9e22e9e083861c614353fc0b96ca9f82c504e5e6.

Change-Id: I84cd5c3c37a85f4dcd1691526cf426d197ea6c62
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
12 files changed:
README.markdown
lib/puppet/provider/odl_user/idm.rb [deleted file]
lib/puppet/type/odl_user.rb [deleted file]
manifests/config.pp
manifests/init.pp
manifests/params.pp
spec/acceptance/class_spec.rb
spec/classes/opendaylight_spec.rb
spec/spec_helper.rb
spec/spec_helper_acceptance.rb
spec/unit/provider/idm_spec.rb [deleted file]
spec/unit/type/odl_user_spec.rb [deleted file]

index 419592db17b25999f3b451515776d0ad173f55a7..651bb47bbb68e9f65f7629a583f6e34decefe0d1 100644 (file)
@@ -346,22 +346,6 @@ Default: `'-Djava.net.preferIPv4Stack=true'`
 
 Valid options: A string of valid Java options.
 
-##### `username`
-
-Specifies the username to set for admin role in ODL.
-
-Default: `'admin'`
-
-Valid options: A username string.
-
-##### `password`
-
-Specifies the password to set for admin role in ODL.
-
-Default: `'admin'`
-
-Valid options: A password string.
-
 ## Limitations
 
 - Tested on CentOS 7 and Ubuntu 16.04.
diff --git a/lib/puppet/provider/odl_user/idm.rb b/lib/puppet/provider/odl_user/idm.rb
deleted file mode 100644 (file)
index da48aa5..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-Puppet::Type.type(:odl_user).provide(:idm) do
-
-  commands :java => 'java'
-
-  def odl_path
-    '/opt/opendaylight'
-  end
-
-  def idm_cmd(*args)
-    java('-jar', "#{odl_path}/bin/aaa-cli-jar.jar", '--dbd', odl_path, *args)
-  end
-
-  def create
-    idm_cmd('--newUser', @resource[:username], '-p', @resource[:password])
-  end
-
-  def destroy
-    idm_cmd('--deleteUser', @resource[:username])
-  end
-
-  def exists?
-    output = idm_cmd('-l').split("\n")
-    output.each do |line|
-      if line.eql? @resource[:username]
-        return true
-      end
-    end
-    return false
-  end
-
-  def password
-    return false
-  end
-
-  def password=(password)
-    destroy
-    idm_cmd('--newUser', @resource[:username], '-p', password)
-  end
-
-end
diff --git a/lib/puppet/type/odl_user.rb b/lib/puppet/type/odl_user.rb
deleted file mode 100644 (file)
index 21904a2..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-Puppet::Type.newtype(:odl_user) do
-
-  ensurable
-
-  newparam(:username, :namevar => true) do
-    desc "Username to configure in ODL IDM with admin role"
-    newvalues(/^\w+$/)
-  end
-
-  newproperty(:password) do
-    desc "Password for this user"
-    validate do |value|
-      if !value.is_a?(String)
-        raise ArgumentError, "Passwords must be a string"
-      end
-    end
-
-    def change_to_s(current, desire)
-      "Password changed"
-    end
-  end
-
-end
index b99a2f02380c5459ba7d9dfc634f836cc55af6b9..0f1fb5c10e31cb72eff5742fd3bac5aa065c2157 100644 (file)
@@ -107,10 +107,4 @@ class opendaylight::config {
       match => '^routing-node=.*$',
     }
   }
-
-  # Configure username/password
-  odl_user { $::opendaylight::username:
-    password => $::opendaylight::password,
-    before   => Service['opendaylight'],
-  }
 }
index 34d42bd264f9db330febb364602242780c7d15ef..ae7b4f988fded59f06837df6667470f8671fdbb3 100644 (file)
@@ -53,8 +53,6 @@ class opendaylight (
   $vpp_routing_node    = $::opendaylight::params::vpp_routing_node,
   $java_opts           = $::opendaylight::params::java_opts,
   $manage_repositories = $::opendaylight::params::manage_repositories,
-  $username            = $::opendaylight::params::username,
-  $password            = $::opendaylight::params::password,
 ) inherits ::opendaylight::params {
 
   # Validate OS family
index 0f50662ff2e83b45cd50d671e387185edf66e55c..6ea13119b97424c9ae7653a02488e51b7abee501 100644 (file)
@@ -22,6 +22,4 @@ class opendaylight::params {
   $vpp_routing_node = ''
   $java_opts = '-Djava.net.preferIPv4Stack=true'
   $manage_repositories = true
-  $username = 'admin'
-  $password = 'admin'
 }
index 341bf2ca5a1d7c76782650a66af12ff9e898bfac..9e213906763d1ba1cf79122af915a21e50ddca88 100644 (file)
@@ -122,16 +122,4 @@ describe 'opendaylight class' do
       log_level_validations(log_levels: custom_log_levels)
     end
   end
-
-  describe 'testing odl username/password' do
-    context 'using default username/password' do
-    context 'using default log levels' do
-      # Call specialized helper fn to install OpenDaylight
-      install_odl({:extra_features => ['odl-restconf']})
-
-      # Call specialized helper fn for username/password validations
-      username_password_validations
-    end
-    end
-  end
 end
index 2d3d6eb1b66bff240d821bc57d69ce7de6b7a35b..deddde8158eb18ce678b122bf532df141c2d5160 100644 (file)
@@ -733,52 +733,4 @@ describe 'opendaylight' do
     end
   end
 
-  # ODL username/password tests
-  describe 'ODL username/password tests' do
-    # Non-OS-type tests assume CentOS 7
-    #   See issue #43 for reasoning:
-    #   https://github.com/dfarrell07/puppet-opendaylight/issues/43#issue-57343159
-    osfamily = 'RedHat'
-    operatingsystem = 'CentOS'
-    operatingsystemmajrelease = '7'
-    context 'using default username/password' do
-      let(:facts) {{
-        :osfamily => osfamily,
-        :operatingsystem => operatingsystem,
-        :operatingsystemmajrelease => operatingsystemmajrelease,
-      }}
-
-      let(:params) {{ }}
-
-      # Run shared tests applicable to all supported OSs
-      # Note that this function is defined in spec_helper
-      generic_tests
-
-      # Run test that specialize in checking username/password config
-      # Note that this function is defined in spec_helper
-      username_password_tests('admin','admin')
-    end
-
-    context 'specifying non-default username/password' do
-      let(:facts) {{
-        :osfamily => osfamily,
-        :operatingsystem => operatingsystem,
-        :operatingsystemmajrelease => operatingsystemmajrelease,
-      }}
-
-      let(:params) {{
-        :username => 'test',
-        :password => 'test'
-      }}
-
-      # Run shared tests applicable to all supported OSs
-      # Note that this function is defined in spec_helper
-      generic_tests
-
-      # Run test that specialize in checking routing-node config
-      # Note that this function is defined in spec_helper
-      username_password_tests('test', 'test')
-    end
-  end
-
 end
index cd9457b4451c9ae8eba2d9816e00451599ba7190..e6bf0944fda1988a53c47be3042033bca96a6ec3 100644 (file)
@@ -361,13 +361,3 @@ def vpp_routing_node_tests(options = {})
     }
   end
 end
-
-# ODL username/password tests
-def username_password_tests(username, password)
-
-  it {
-    should contain_odl_user(username).with(
-      :password => password
-    )
-  }
-end
index 712004dcb74f085fcb453311899d03ed73a6a87a..f911b3d40e965d73d19a99c35beb386339b3090a 100644 (file)
@@ -71,8 +71,6 @@ def install_odl(options = {})
   enable_ha = options.fetch(:enable_ha, false)
   ha_node_ips = options.fetch(:ha_node_ips, [])
   ha_node_index = options.fetch(:ha_node_index, 0)
-  username = options.fetch(:username, 'admin')
-  password = options.fetch(:password, 'admin')
 
   # Build script for consumption by Puppet apply
   it 'should work idempotently with no errors' do
@@ -87,8 +85,6 @@ def install_odl(options = {})
       ha_node_ips=> #{ha_node_ips},
       ha_node_index=> #{ha_node_index},
       log_levels=> #{log_levels},
-      username=> #{username},
-      password=> #{password},
     }
     EOS
 
@@ -334,21 +330,3 @@ def deb_validations()
     it { should be_installed }
   end
 end
-
-# Shared function for validations related to username/password
-def username_password_validations(options = {})
-  # NB: This param default should match the one used by the opendaylight
-  #   class, which is defined in opendaylight::params
-  # TODO: Remove this possible source of bugs^^
-  odl_username = options.fetch(:username, 'admin')
-  odl_password = options.fetch(:password, 'admin')
-  odl_check_url = 'http://127.0.0.1:8080/restconf'
-
-  describe file('/opt/opendaylight/idmlight.db.mv.db') do
-    it { should be_file }
-  end
-
-  describe command("sleep 60 && curl -o /dev/null --fail --silent --head -u #{odl_username}:#{odl_password} #{odl_check_url}") do
-    its(:exit_status) { should eq 0 }
-  end
-end
diff --git a/spec/unit/provider/idm_spec.rb b/spec/unit/provider/idm_spec.rb
deleted file mode 100644 (file)
index a8e3cf2..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-require 'puppet'
-require 'puppet/provider/odl_user/idm'
-require 'spec_helper'
-
-provider_class = Puppet::Type.type(:odl_user).provider(:idm)
-
-describe 'Puppet::Type.type(:odl_user).provider(:idm)' do
-
-  let :odl_attrs do
-    {
-      :username => 'admin',
-      :ensure   => 'present',
-    }
-  end
-
-  let :resource do
-    Puppet::Type::Odl_user.new(odl_attrs)
-  end
-
-  let :provider do
-    provider_class.new(resource)
-  end
-
-  describe 'on create' do
-    it 'should call idm to create user' do
-      provider.expects(:idm_cmd)
-      provider.create
-    end
-  end
-
-  describe "when changing password" do
-    it 'should change password' do
-      provider.expects(:destroy)
-      provider.expects(:idm_cmd)
-      provider.password = 'admin'
-    end
-  end
-end
diff --git a/spec/unit/type/odl_user_spec.rb b/spec/unit/type/odl_user_spec.rb
deleted file mode 100644 (file)
index e9b0942..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-require 'puppet'
-require 'puppet/type/odl_user'
-require 'spec_helper'
-
-describe 'Puppet::Type.type(:odl_user)' do
-
-  it 'should accept username/password' do
-    Puppet::Type.type(:odl_user).new(:username => 'admin', :password => 'admin')
-  end
-
-end