Giter VIP home page Giter VIP logo

Comments (6)

shortdudey123 avatar shortdudey123 commented on August 16, 2024

What version of the cookbook are you using?

Integration tests show this is working correctly

         File "/etc/fstab"
           should be file
           content
             should match /^gluster2:\/gv0 \/mnt\/gv0 glusterfs defaults,_netdev,backupvolfile-server=gluster1 0 0$/

from chef-gluster.

vchung-nz avatar vchung-nz commented on August 16, 2024

I am using 5.0.2 as well.

I am not sure why the current code passed testing but it should not have worked because of how the "===" method is evaluated for class. Please search for "ruby class in case statement" in your favourite search engine for detail.

from chef-gluster.

shortdudey123 avatar shortdudey123 commented on August 16, 2024

What are you putting in for backup_server? and what does /etc/fstab show?

from chef-gluster.

vchung-nz avatar vchung-nz commented on August 16, 2024

I have tried both

    backup_server "backup1"
    backup_server ["backup1", "backup2"]

With either case, I always ended with just the default mount_option: "defaults,_netdev". So to debug this behaviour I added a fallback else statement to mount.rb

def mount_options_for_backup_server
  case new_resource.backup_server.class
  when String
    ',backupvolfile-server=' + new_resource.backup_server
  when Array
    ',backupvolfile-server=' + new_resource.backup_server.join(',backupvolfile-server=')
  else
    Chef::Log.info "backup_server has unknown class? [" + new_resource.backup_server.class.name + "]"
  end

The case statement always fell through, even thought the class is shown correctly as "String" or "Array" in the log output. After further research I found that the object itself should be in the case statement, not object.class, eg

def mount_options_for_backup_server
  case new_resource.backup_server
  when String

It works for me once I made this change.

from chef-gluster.

shortdudey123 avatar shortdudey123 commented on August 16, 2024

Hmm i see what you mean with respect to classes in case statements on http://blog.honeybadger.io/rubys-case-statement-advanced-techniques/
However, if thats true, then integration tests should be failing

from chef-gluster.

shortdudey123 avatar shortdudey123 commented on August 16, 2024

Solved by #72

from chef-gluster.

Related Issues (20)

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.