Class: Chef::Knife::Cloud::OpenstackImageList
Instance Method Summary
collapse
included
#create_service_instance, #instance_addresses, #primary_network_ip_address, #primary_private_ip_address, #primary_public_ip_address, #validate!
Instance Method Details
#before_exec_command ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/chef/knife/openstack_image_list.rb', line 38
def before_exec_command
unless config[:disable_filter]
@resource_filters = [{ attribute: "name", regex: /initrd$|kernel$|loader$|virtual$|vmlinuz$/ }]
end
@columns_with_info = [
{ label: "Name", key: "name" },
{ label: "ID", key: "id" },
{ label: "Snapshot", key: "metadata", value_callback: method(:is_image_snapshot) },
]
@sort_by_field = "name"
end
|
#is_image_snapshot(metadata) ⇒ Object
56
57
58
59
60
61
62
63
64
|
# File 'lib/chef/knife/openstack_image_list.rb', line 56
def is_image_snapshot(metadata)
snapshot = "no"
metadata.each do |datum|
if (datum.key == "image_type") && (datum.value == "snapshot")
snapshot = "yes"
end
end
snapshot
end
|
#query_resource ⇒ Object
52
53
54
|
# File 'lib/chef/knife/openstack_image_list.rb', line 52
def query_resource
@service.list_images
end
|