Jira (FACT-2884) How to disable Querying Ec2 metadata

32 views
Skip to first unread message

Sanjay Tripathi (Jira)

unread,
Dec 1, 2020, 9:40:03 PM12/1/20
to puppe...@googlegroups.com
Sanjay Tripathi created an issue
 
Facter / Bug FACT-2884
How to disable Querying Ec2 metadata
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2020/12/01 6:39 PM
Environment:

In non-cloud environment, issuing the request to http://169.254.169.254/latest/meta-data   causes delay in execution:

Facter: Querying Ec2 metadata
Facter: Trying to connect to http://169.254.169.254/latest/meta-data/ but got: execution expired

How to disable this query (don't need it in a non-cloud environment)?

Tried setting the environment variable FACTER_virtual=generic but that does not suppress this query in non-cloud environment.

Priority: Critical Critical
Reporter: Sanjay Tripathi

Add new os support on litmus modules

Before to start, make sure the new platform is provided by vmpooler and it's fully equipped
an image with the new os is available from puppet agent team

Here you can find a list with all the converted modules to use litmus

Step1: Using pdksync, check/update metadata.json, ci-job-configs/jenkii/platform/projects/modules-unified.yaml

metadata.json file

  • check for section: operatingsystem_support
  • add new version under the intended operatingsystem and save

ci-job-configs/jenkii/platform/projects/modules-unified.yaml

  • check for the module and add new platform under smoke_platforms| pe_platforms (if this platform was released)

Step2: Using pdksync, create PR with the changes on modules
Step3: Create PR on ci-job-configs
Step4: Deploy experimental platform intended module
Step5: Run ad-hoc tests using that experimental
Step6: Check testing results
Step7: If failures, fix them, re-execute all the testing part until they are green
Step8: Ask for review/merge

check for vmpooler platform
pdksync: update metadata.json
pdksync: push changes, create commit
create PR on ci-job-configs
deploy experimental platform intended module
run tests through ad-hoc jenkins using that experimental
check testing report
if failures, fix them, re-execute ad-hoc until they are green
review/merge PR

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Bogdan Irimie (Jira)

unread,
Dec 2, 2020, 3:02:03 AM12/2/20
to puppe...@googlegroups.com
Bogdan Irimie updated an issue
Change By: Bogdan Irimie
Sprint: ghost-2.12
Sub-team: ghost
Team: Night's Watch

Bogdan Irimie (Jira)

unread,
Dec 2, 2020, 6:50:02 AM12/2/20
to puppe...@googlegroups.com
Bogdan Irimie assigned an issue to Unassigned
Change By: Bogdan Irimie
Assignee: Bogdan Irimie

Bogdan Irimie (Jira)

unread,
Dec 2, 2020, 6:50:03 AM12/2/20
to puppe...@googlegroups.com
Bogdan Irimie assigned an issue to Bogdan Irimie

Bogdan Irimie (Jira)

unread,
Dec 2, 2020, 6:51:03 AM12/2/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Dec 2, 2020, 8:16:03 AM12/2/20
to puppe...@googlegroups.com
Bogdan Irimie commented on Bug FACT-2884
 
Re: How to disable Querying Ec2 metadata

Hi Sanjay Tripathi

Setting the FACTER_virtual=generic will not work in Facter 4. This worked in Facter 3 because EC2 facts made a check on `virtual` fact before they were resolved.

If you don't need EC2 facts, an elegant solution is to block them using `facter.conf`. The default location for `facter.conf` is `/etc/puppetlabs/facter/facter.conf`

e.g.

facts : {
    blocklist : [ "EC2" ],
}

You can check if EC2 fact are resolved by running `facter --debug` and searching for `Querying Ec2 metadata`. If you block the EC2 facts, you should not see this message in debug mode.

Bogdan Irimie (Jira)

unread,
Dec 2, 2020, 11:33:03 AM12/2/20
to puppe...@googlegroups.com
Bogdan Irimie assigned an issue to Bogdan Irimie
Change By: Bogdan Irimie
Assignee: Bogdan Irimie

Sanjay Tripathi (Jira)

unread,
Dec 2, 2020, 12:38:04 PM12/2/20
to puppe...@googlegroups.com
Sanjay Tripathi commented on Bug FACT-2884
 
Re: How to disable Querying Ec2 metadata

Yes, it does block the EC2 fact when the blocklist is added in facter.conf:
Debug: Facter: blocking collection of EC2 facts

Can facter.conf be kept in the config directory passed to puppet apply via --confdir? Asking because we may not want to modify the global facter.conf.

Sanjay Tripathi (Jira)

unread,
Dec 2, 2020, 1:31:03 PM12/2/20
to puppe...@googlegroups.com

To elaborate on my previous comment, we would like to avoid making this change in the global facter.conf. Adding it in local facter.conf does not seem to be effective. The environment variable Facter_generic provided the flexibility of turning off EC2 queries without changing the global facter.conf. Can we get a similar solution in Facter 4.x?

Josh Cooper (Jira)

unread,
Dec 2, 2020, 2:12:03 PM12/2/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
Environment: In non-cloud environment, issuing the request to http://169.254.169.254/latest/meta-data   causes delay in execution:

Facter: Querying Ec2 metadata
Facter: Trying to connect to http://169.254.169.254/latest/meta-data/ but got: execution expired

How to disable this query (don't need it in a non-cloud environment)?

Tried setting the environment variable FACTER_virtual=generic but that does not suppress this query in non-cloud environment.

Josh Cooper (Jira)

unread,
Dec 2, 2020, 2:12:04 PM12/2/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
In non-cloud environment, issuing the request to [http://169.254.169.254/latest/meta-data]   causes delay in execution:

Facter: Querying Ec2 metadata
Facter: Trying to connect to [http://169.254.169.254/latest/meta-data/] but got: execution expired

How to disable this query (don't need it in a non-cloud environment)?

Tried setting the environment variable FACTER_virtual=generic but that does not suppress this query in non-cloud environment.

----

Add new os support on litmus modules

*Before to start, make sure the new platform is provided by vmpooler and it's fully equipped*
*an image with the new os is available from puppet agent team*

[Here|https://confluence.puppetlabs.com/display/ECO/How+to+add+support+for+new+platforms] you can find a list with all the converted modules to use litmus


Step1: Using pdksync, check/update metadata.json, ci-job-configs/jenkii/platform/projects/modules-unified.yaml

*metadata.json file*
- check for section: operatingsystem_support
- add new version under the intended operatingsystem and save

*[ci-job-configs/jenkii/platform/projects/modules-unified.yaml|https://github.com/puppetlabs/ci-job-configs/blob/master/jenkii/platform/projects/modules-unified.yaml]*
- check for the module and add new platform under smoke_platforms| pe_platforms (if this platform was released)


Step2: Using pdksync, create PR with the changes on modules

Step4: Deploy experimental platform intended module
Step5: Run ad-hoc tests using that experimental
Step6: Check testing results
Step7: If failures, fix them, re-execute all the testing part until they are green
Step8: Ask for review/merge

(-) check for vmpooler platform
(-) pdksync: update metadata.json
(-) pdksync: push changes, create commit
(-) create PR on ci-job-configs
(-) deploy experimental platform intended module
(-) run tests through ad-hoc jenkins using that experimental
(-) check testing report
(-) if failures, fix them, re-execute ad-hoc until they are green
(-) review/merge PR

Bogdan Irimie (Jira)

unread,
Dec 3, 2020, 12:22:04 PM12/3/20
to puppe...@googlegroups.com
Bogdan Irimie commented on Bug FACT-2884
 
Re: How to disable Querying Ec2 metadata

Sanjay Tripathi Unfortunately `facter.conf` path cannot be passed to puppet.

Would it help you if we made it possible to override the EC2 facts with

FACTER_ec2_metadata= generic
FACTER_ec2_userdata= generic

and these facts would not make the API calls anymore, they will return the `generic` value?

Sanjay Tripathi (Jira)

unread,
Dec 3, 2020, 12:40:02 PM12/3/20
to puppe...@googlegroups.com

Yes, this will definitely help! Thanks for proposing this solution. Can it be possible to get it into the next Facter 4.x release?

Josh Cooper (Jira)

unread,
Dec 4, 2020, 10:21:04 AM12/4/20
to puppe...@googlegroups.com

Bogdan Irimie (Jira)

unread,
Dec 7, 2020, 3:47:03 AM12/7/20
to puppe...@googlegroups.com
Bogdan Irimie assigned an issue to Unassigned
Change By: Bogdan Irimie
Assignee: Bogdan Irimie

Florin Dragos (Jira)

unread,
Dec 7, 2020, 10:03:04 AM12/7/20
to puppe...@googlegroups.com
Florin Dragos assigned an issue to Florin Dragos
Change By: Florin Dragos
Assignee: Florin Dragos
Reply all
Reply to author
Forward
0 new messages