fog-google icon indicating copy to clipboard operation
fog-google copied to clipboard

Fog::Compute::Google::Disk attach_disk NoMethodError

Open rchekaluk opened this issue 1 year ago • 0 comments

fog-google 1.22.0 fog-core 2.2.4 ruby 3.1.2p20

Running the attached snippet (redacted) for attaching a disk to a running instance, throws an error:

/usr/share/rvm/gems/ruby-3.1.2/gems/fog-google-1.22.0/lib/fog/compute/google/models/server.rb:280:in `attach_disk': undefined method `get_attached_disk' for   <Fog::Compute::Google::Disk (NoMethodError)
    name="fog-google-tester-data-1698268008",
    kind="compute#disk",
    id=REDACTED,
    creation_timestamp="2023-10-25T14:06:48.412-07:00",
    zone="https://www.googleapis.com/compute/v1/projects/REDACTED/zones/us-east4-a",
    status="READY",
    description="created with fog",
    size_gb=1,
    self_link="https://www.googleapis.com/compute/v1/projects/REDACTED/zones/us-east4-a/disks/fog-google-tester-data-1698268008",
    source_image=nil,
    source_image_id=nil,
    source_snapshot=nil,
    source_snapshot_id=nil,
    type="https://www.googleapis.com/compute/v1/projects/REDACTED/zones/us-east4-a/diskTypes/pd-standard",
    labels=nil,
    label_fingerprint="\\xE3e\\xA6J\\x90|\\xAD#",
    users=nil
  >:Fog::Compute::Google::Disk

            disk_obj = disk.get_attached_disk
                           ^^^^^^^^^^^^^^^^^^
Did you mean?  get_as_boot_disk
	from google-fog-attach_disk1.rb:39:in `<main>'

Running the alternate form of attach_disk:

resp = instance.attach_disk(datadisk_name, false)

throws a different error:

/usr/share/rvm/gems/ruby-3.1.2/gems/fog-google-1.22.0/lib/fog/compute/google/models/disks.rb:69:in `attached_disk_obj': wrong number of arguments (given 2, expected 1) (ArgumentError)
	from /usr/share/rvm/gems/ruby-3.1.2/gems/fog-google-1.22.0/lib/fog/compute/google/models/server.rb:282:in `attach_disk'
	from google-fog-attach_disk2.rb:39:in `<main>'

I am unclear if these errors are due to my incorrect usage of fog-google (could not find any usage examples), or if the gem is not feature-complete.

rchekaluk avatar Oct 25 '23 21:10 rchekaluk