[Solved] Filter aws public amis


#1

Hey All,

I running manageiq docker (manageiq/manageiq:euwe-2 vibrant_brahmagupta). I am able to setup the aws provider but its only seeing the private images. I have set “:get_public_images: true” Also I expect once I get this working I will want to filter it. Is it possible to provide some examples of how to use the filter? Something like all Red Hat Community AMIs for 7.3

Have reviewed a few articles on the topic, but I am unable to get it going.

Part of what I am trying to achieve with the docker setup is to have a manageiq version as close as possible to cfme 4.2 (Version / Build 5.7.1.3) Perhaps that should be the starting point for advising a fix and providing guidance.

Thanks


#2

Hey @gmccullough any pointers please?

Thanks


#3

Hi @dan

Right below :get_public_images:true in the advanced settings you can create a filter. Below I have pasted an example of a filter based on image_id:

    :get_public_images: true
    # configure an array of filters to be added to describe_images
    :public_images_filters:
      - :name: image-id
        :values:
          - ari-fcfd1095

Below are links to some relevant documentation:
http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Types/Filter.html
http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Client.html#describe_images-instance_method

HTH
Bronagh


#4

Hi @bronaghs

Thanks. Might be just case of giving the provider time to load the images? My provider now has the aws public images count, which is progress since before I did have this. Think its just taking a lot of time to build especially on my dev laptop docker. Been trying to use the logs (/var/www/miq/vmdb/log/aws, evm, prod) inside the container to see whats happening, but they are pretty static. Perhaps also a lag in writing to them?

I have updated the filter to the redhat owner (i believe):
:ec2:
:get_private_images: true
:get_shared_images: true
:get_public_images: true
:public_images_filters:
- :name: owner_id
:values:
- 309956199498

But still seeing all the public images. How can see whether its working? Any logs i should check?

Thanks again


#5

less doesnt seem to work in the container. saw the message below in the provider gui and then used tail on the evm log and found it there. answers the log question.

Error: [expected params[:filters][0][:values][0] to be a string

Also noticed your example is :name: image-id and aws docs are image_id


#6

less weirdness continues… some other buffer thing :blush: It there but not displaying fully…:face_with_raised_eyebrow:

----] E, [2017-10-09T05:08:55.344717 #20052:2ab50fb49134] ERROR – : [EmsRefres
h::Refreshers::EmsRefresherMixin::PartialRefreshError]: expected params[:filters
][0][:values][0] to be a string Method:[rescue in deliver]
[----] E, [2017-10-09T05:08:55.344850 #20052:2ab50fb49134] ERROR – : /var/www/m
iq/vmdb/app/models/ems_refresh/refreshers/ems_refresher_mixin.rb:50:in refresh' /var/www/miq/vmdb/app/models/manageiq/providers/base_manager/refresher.rb:10:inrefresh’
/var/www/miq/vmdb/app/models/ems_refresh.rb:91:in block in refresh' /var/www/miq/vmdb/app/models/ems_refresh.rb:90:ineach’
/var/www/miq/vmdb/app/models/ems_refresh.rb:90:in refresh' /var/www/miq/vmdb/app/models/miq_queue.rb:347:inblock in deliver’
/opt/rubies/ruby-2.3.1/lib/ruby/2.3.0/timeout.rb:91:in block in timeout' /opt/rubies/ruby-2.3.1/lib/ruby/2.3.0/timeout.rb:33:inblock in catch’
/opt/rubies/ruby-2.3.1/lib/ruby/2.3.0/timeout.rb:33:in catch' /opt/rubies/ruby-2.3.1/lib/ruby/2.3.0/timeout.rb:33:incatch’
/opt/rubies/ruby-2.3.1/lib/ruby/2.3.0/timeout.rb:106:in timeout' /var/www/miq/vmdb/app/models/miq_queue.rb:343:indeliver’


#7

ok, my bad. needs to be image-id and i think the weirdness is resource related… container may be struglling


#8

A mix of resources (mem) for the container and the time required for the 52k image sync was it. Have got public images and filtering going.


#9

Great, glad its all working now @dan.

Bronagh