Giter Club home page Giter Club logo

bmclib's People

Contributors

bobtfish avatar fhats avatar ifireball avatar logicminds avatar ofalk avatar razorsedge avatar solarkennedy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bmclib's Issues

error when running puppet resource

when running puppet resource bmc I get the following error.

Error: Could not run: undefined method `collect' for #Puppet::Type::Bmc::ProviderIpmitool:0x7fdf9cd00d30

Bug: new_user_id() fails to get users

Board: Intel
OS: Debian 8.10
Packages:

  • ipmitool 1.8.14-4
  • libopenipmi0 2.0.16-1.4
  • openipmi 2.0.16-1.4

The function new_user_id() fails to create / assign an ID for the new users on my Intel board, because there is no user (probably default on other systems) Empty .

user = users.find {|user| user[:name] =~ /Empty/i } || users.find {|user| !user[:enabled] } 
   ipmitool user list 1
   ID  Name	     Callin  Link Auth	IPMI Msg   Channel Priv Limit
   1                    false   false      true       ADMINISTRATOR
   2   root             false   true       true       ADMINISTRATOR
   4   test2            false   false      true       ADMINISTRATOR

if I create the user Empty over the UI manually, it fails with another error:

Error: /Stage[main]/Profile::Ipmi/Bmcuser[root2]/ensure: change from 'absent' to 'present' failed: Execution of '/usr/bin/ipmitool user priv 3 4 3' returned 1: Set Privilege Level command failed (user 3): Invalid data field in request
(but that's maybe related a wrong resource on my side)

implement channel_enabled?

The bmc provider for ipmitool needs to query the ipmitool to verify that the channel is enabled.

Currently in the exists? method there is a bug where if the channel is disabled the channel could never be enabled unless one of the network properties changed.

We just need to figure out how to query ipmi to find out if the channel is enabled.

def channel_enabled?
# TODO implement how to look up this info
true
end

Error message on pupet 3.7.2

For the following manifest:

class { 'bmclib':}

bmc { 'ipmidevice':
  ensure => present,
  provider => 'ipmitool',
}

I'm getting the following error message:

Error: Could not prefetch bmc provider 'ipmitool': undefined method `find' for #<Puppet::Type::Bmc::ProviderIpmitool:0x7facad506750>

This is on EL6 using puppet 3.7

logicminds-bmclib ships Apple resource forks

version: 0.1.1

$ find bmclib/ -type f -exec file {} \;|grep -v .svn|egrep -i 'apple|Macintosh'
bmclib/._manifests: AppleDouble encoded Macintosh file
bmclib/._metadata.json: AppleDouble encoded Macintosh file
bmclib/._spec: AppleDouble encoded Macintosh file
bmclib/._LICENSE.txt: AppleDouble encoded Macintosh file
bmclib/tests/._ipmievd.pp: AppleDouble encoded Macintosh file
bmclib/tests/._example.pp: AppleDouble encoded Macintosh file
bmclib/tests/._init.pp: AppleDouble encoded Macintosh file
bmclib/._Gemfile.lock: AppleDouble encoded Macintosh file
bmclib/._Gemfile: AppleDouble encoded Macintosh file
bmclib/._DEVELOP.md: AppleDouble encoded Macintosh file
bmclib/._Rakefile: AppleDouble encoded Macintosh file
bmclib/._tests: AppleDouble encoded Macintosh file
bmclib/._EXAMPLES.md: AppleDouble encoded Macintosh file
bmclib/._README.md: AppleDouble encoded Macintosh file
bmclib/._Modulefile: AppleDouble encoded Macintosh file
bmclib/spec/._hosts: AppleDouble encoded Macintosh file
bmclib/spec/unit/._puppet: AppleDouble encoded Macintosh file
bmclib/spec/unit/puppet/._provider: AppleDouble encoded Macintosh file
bmclib/spec/unit/puppet/provider/bmc/._ipmitool_spec.rb: AppleDouble encoded Macintosh file
bmclib/spec/unit/puppet/provider/._bmcuser: AppleDouble encoded Macintosh file
bmclib/spec/unit/puppet/provider/._bmc: AppleDouble encoded Macintosh file
bmclib/spec/unit/puppet/provider/bmcuser/._ipmitool_spec.rb: AppleDouble encoded Macintosh file
bmclib/spec/unit/puppet/type/._bmc_spec.rb: AppleDouble encoded Macintosh file
bmclib/spec/unit/puppet/type/._bmcuser_spec.rb: AppleDouble encoded Macintosh file
bmclib/spec/unit/puppet/._type: AppleDouble encoded Macintosh file
bmclib/spec/unit/._facter: AppleDouble encoded Macintosh file
bmclib/spec/unit/facter/._bmc_device_present_spec.rb: AppleDouble encoded Macintosh file
bmclib/spec/._classes: AppleDouble encoded Macintosh file
bmclib/spec/fixtures/._manifests: AppleDouble encoded Macintosh file
bmclib/spec/fixtures/._modules: AppleDouble encoded Macintosh file
bmclib/spec/._spec.opts: AppleDouble encoded Macintosh file
bmclib/spec/classes/._bmclib_init_spec.rb: AppleDouble encoded Macintosh file
bmclib/spec/classes/._bmc_example_spec.rb: AppleDouble encoded Macintosh file
bmclib/spec/classes/._bmclib_ipmievd_spec.rb: AppleDouble encoded Macintosh file
bmclib/spec/classes/._bmclib_spec.rb: AppleDouble encoded Macintosh file
bmclib/spec/classes/._bmcuser_example_spec.rb: AppleDouble encoded Macintosh file
bmclib/spec/._defines: AppleDouble encoded Macintosh file
bmclib/spec/._fixtures: AppleDouble encoded Macintosh file
bmclib/spec/._unit: AppleDouble encoded Macintosh file
bmclib/spec/._spec_helper.rb: AppleDouble encoded Macintosh file
bmclib/spec/._functions: AppleDouble encoded Macintosh file
bmclib/._lib: AppleDouble encoded Macintosh file
bmclib/lib/._puppet: AppleDouble encoded Macintosh file
bmclib/lib/puppet/._provider: AppleDouble encoded Macintosh file
bmclib/lib/puppet/provider/bmc/._ipmitool.rb: AppleDouble encoded Macintosh file
bmclib/lib/puppet/provider/._bmcuser: AppleDouble encoded Macintosh file
bmclib/lib/puppet/provider/._bmc: AppleDouble encoded Macintosh file
bmclib/lib/puppet/provider/bmcuser/._ipmitool.rb: AppleDouble encoded Macintosh file
bmclib/lib/puppet/type/._bmcuser.rb: AppleDouble encoded Macintosh file
bmclib/lib/puppet/type/._bmc.rb: AppleDouble encoded Macintosh file
bmclib/lib/puppet/._type: AppleDouble encoded Macintosh file
bmclib/lib/._facter: AppleDouble encoded Macintosh file
bmclib/lib/facter/._bmc_device_present.rb: AppleDouble encoded Macintosh file
bmclib/lib/facter/._bmc.rb: AppleDouble encoded Macintosh file
bmclib/manifests/._ipmievd.pp: AppleDouble encoded Macintosh file
bmclib/manifests/._init.pp: AppleDouble encoded Macintosh file

ipmitoolcmd ... doesn't work because it needs and array, not a string of args

So I'm getting around wanting to use this on real hardware with @fhats, on lots of different distros, puppet versions, etc.

But I'm finding that.. using the provider directly doesn't seem to work.

Like this part of self.instances in bmcuser:

     userdata = ipmitoolcmd(["user list 1"])

Should be:

      userdata = ipmitoolcmd(['user', 'list', '1'])

I must be the first person to actually run this, or maybe it worked on some other version of puppet or ruby that I don't have? (I've got a bunch)

How would you feel about giving me contributor access? Now that I need to run this at my own work, I'll be iterating rapidly, writing tests, triaging PR's etc?

Even if not, I would like to see more master development, and let releases to the forge be the stable part. When master doesn't change much, and bug fixes get dispersed across other people's forks, things get stale, and the barrier to big PRs gets larger.

I guess what I'm saying is: I don't want to maintain my own separate fork, build up a lot of changes quickly (I intend to get this working this week), and do a Massive PR like @razorsedge. :(

Clarify Module Deliverables?

In the "About" section of the README.md, it states that "The BMClib is a puppet library that provides bmc related facts as well as a bmc type and bmcuser type. Currently the only provider available is ipmitool. However, in the future additional provider types will include freeipmi, hponcfg, and other oem related tools." (emphasis mine)

I see that there are classes to install ipmitool, which confuses me. I think that ipmitool management should be via a separate module (like perhaps jhoblitt/ipmi). This would fit in nicely with using logicminds/hpilo as a future provider.

Am I incorrect in how I have interpreted the intent of this module? Does it make sense to have an empty Class['bmclib'] and reject my PR #3 to add support for Service['ipmievd']?

bmcuser shows password

The bmcuser provider shows the password when a resource is declared. We need to implement the to_s function to override the password and hide the value.

error during fact retrieval with openipmi not installed

Could not retrieve fact='bmc_mac', resolution='<anonymous>': undefined method `empty?' for nil:NilClass
Could not retrieve fact='bmc_subnet', resolution='<anonymous>': undefined method `empty?' for nil:NilClass
Could not retrieve fact='bmc_ip', resolution='<anonymous>': undefined method `empty?' for nil:NilClass
Could not retrieve fact='bmc_gateway', resolution='<anonymous>': undefined method `empty?' for nil:NilClass

Feature request: watchdog

Would be great to improve the ipmitool provider with the watchdog command.

this helps to reboot the system, after x seconds, if the machine freezed.

ipmitool mc watchdog on

Change License to LGPL

Hi,

Since this is library like source code it would be better to have the license code to LGPL.

If all are in agreement I will switch to this to LGPL.

For those who have contributed, please respond to so that we all agree to this license change. (yes/no) is all that is needed.

@razorsedge
@solarkennedy
@Codeacious
@fhats
@bobtfish

Thanks everyone for the contributions thus far.

Suggestion for the bmc fact

bmclib is extremely helpful, thank you!

FYI, I modified the code to combine all the separate facts into one structured fact, called bmc,

Facter.add(:bmc) do
  setcode do
    bmc_hash = {}
    bmc_hash["device_present"] = device_present?
    bmc_hash["tools_present"] = tools_present?
    if device_present? && tools_present?
      bmc_hash["ip"] = ip
      bmc_hash["mac"] = mac
      bmc_hash["netmask"] = subnet
      bmc_hash["gateway"] = gateway
      bmc_hash["vlan"] = vlanid
      bmc_hash["assignment"] = "unknown"
      if dhcp? 
        bmc_hash["assignment"] = "dhcp"
      end
      if static? 
        bmc_hash["assignment"] = "static"
      end
    end
    bmc_hash
  end
end

def lanconfig
  @lanconfig ||= parse_laninfo
end

def parse_laninfo
  if ipmitool.empty? or ipmitool.nil?
    return {}
  end
  channel_lookup = {
    'Dell Inc.'         => 1,
    'FUJITSU'           => 2,
    'FUJITSU SIEMENS'   => 2,
    'HP'                => 2,
    'Intel Corporation' => 3,
  }
  channel = channel_lookup.fetch(Facter.value(:manufacturer), 1)
  landata = Facter::Core::Execution.exec("#{ipmitool} lan print #{channel} 2>/dev/null") || ''
  laninfo = {}
  landata.lines.each do |line|
    # clean up the data from spaces
    item = line.split(':', 2)
    key = item.first.strip.downcase.gsub(' ','_')
    value = item.last.strip
    laninfo[key] = value
  end
  laninfo
end

def ipmitool
  unless @ipmitool
    timeout = Facter::Core::Execution.which('timeout')
    ipmitool_cmd = Facter::Core::Execution.which('ipmitool')
    if ipmitool_cmd and timeout
      @ipmitool = "#{timeout} 2 #{ipmitool_cmd}"
    elsif ipmitool_cmd
      @ipmitool = ipmitool_cmd
    else
      @ipmitool = nil
    end
  end
  @ipmitool
end

def ip
  lanconfig["ip_address"]
end

def mac
  lanconfig["mac_address"]
end

def subnet
  lanconfig["subnet_mask"]
end

def gateway
  lanconfig["default_gateway_ip"]
end

def vlanid
  lanconfig["802.1q_vlan_id"].downcase!
end

def dhcp?
  lanconfig["ip_address_source"].match(/dhcp/i) != nil
end

def static?
  lanconfig["ip_address_source"].match(/static/i) != nil
end

def ipsrc
  lanconfig["ip_address_source"].downcase!
end

def device_present?
  File.exists?('/dev/ipmi0') || File.exists?('/dev/ipmi/0') || File.exists?('/dev/ipmidev/0')
end

def tools_present?
  !Facter::Core::Execution.which('ipmitool').nil?
end

I do not know much about Ruby, so I won't be surprised if there is a better way to do this....

"No set of title patterns matched the title" error

I'm getting the following error when using the bmcuser type:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: No set of title patterns matched the title "ipmi_root".

I don't understand why because this type does not appear to use composite namevar.

this is how I use it:

  bmcuser{'ipmi_root':
    ensure    => enabled,
    provider  => 'ipmitool',
    privlevel => 'admin',
    username  => 'root',
    userpass  => $ipmi_root_user_pass,
    force     => true,
    require   => Class['bmclib']
  }

move to voxpupuli repo

I need more eyeballs on this code and it would be better if we handed this over to voxpupuli so it can be maintained easier.

[Feature] implement getter/setter for password

I would recommend to use getter/setters in the provider. At least for setting the password.

Command for checking / get the password value:
ipmitool user test <userid> 20 <password>

this returns true / false.
fterwards we could set the password only if it's different with the setter method.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.