Jira (FACT-3192) ``facter -p --no-external-facts`` causes ``ERROR Facter::OptionsValidator``

8 views
Skip to first unread message

Gavin Didrichsen (Jira)

unread,
Mar 23, 2023, 6:43:02 AM3/23/23
to puppe...@googlegroups.com
Gavin Didrichsen updated an issue
 
Facter / Bug FACT-3192
``facter -p --no-external-facts`` causes ``ERROR Facter::OptionsValidator``
Change By: Gavin Didrichsen
Summary: Custom fact fails to appear when using some options like ``facter - p - - no-external-facts `` causes ``ERROR Facter::OptionsValidator``
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

Gavin Didrichsen (Jira)

unread,
Mar 29, 2023, 9:56:01 AM3/29/23
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Apr 6, 2023, 2:03:01 PM4/6/23
to puppe...@googlegroups.com
Josh Cooper updated an issue
 
Change By: Josh Cooper
*Desired Behavior:*
This command should work:

{noformat}
$ facter -p --no-external-facts
{noformat}

*Actual Behavior:*
It fails because facter thinks both --external-facts and --no-external-facts have been specified:

{noformat}
[2023-04-06 10:59:58.501545 ] ERROR Facter::OptionsValidator - no-external-facts and external-dir options conflict: please specify only one
{noformat}

*Description*

A customer is seeing some unexpected behaviours when using facter as follows:
* Using``{*}-p-{*}`` and ``{*}-no-external-facts{*}`` together produces an error ``{*}ERROR Facter::OptionsValidator - no-external-facts and external-dir options conflict: please specify only one{*}`` and no facts are returned
* Other variations of facter options fail to return the expected custom fact

I have been able to replicate what the customer is seeing on my lab of 
{code}root@pe-server-238c28-1 development (development)$ facter --version
4.2.14
root@pe-server-238c28-1 development (development)$ 
{code}
 

More detail of my lab setup:
* I have a custom fact defined on my PE, e.g., my environment containse the custom fact here *site-modules/bigbird/lib/facter/bigbird.rb*
* I can see my ``bigbird`` custom fact as expected:

 
{code}root@pe-server-238c28-1 pe_curl_requests (development)$ facter -p bigbird
{
  role => "role::replica",
  sshkey => {
    identifier => "pe-server-238c28-1.us-west1-b.c.customer-support-scratchpad.internal",
    key => "LONGLONGLONGPUBLICKEY",
    type => "ssh-rsa"
  }
}


root@pe-server-238c28-1 pe_curl_requests (development)$ facter -p | grep bigbird
bigbird => {
root@pe-server-238c28-1 pe_curl_requests (development)$ {code}
 
* However, when I introduce other flags I see expected results:

 
{code}# these work
root@pe-server-238c28-1 development (development)$ facter -p --json | grep -E "(oslogin|[^/]bigbird)"
  "bigbird": {
    "oslogin": {
root@pe-server-238c28-1 development (development)$ facter -p bigbird --json | grep -E "(oslogin|[^/]bigbird)"
  "bigbird": {
root@pe-server-238c28-1 development (development)$ 




# these don't work
# custom fact 'bigbird' is not returned unexpectedly
root@pe-server-238c28-1 development (development)$ facter --json | grep -E "(oslogin|[^/]bigbird)"
    "oslogin": {
root@pe-server-238c28-1 development (development)$ 




# no facts returned AND an error is thrown
root@pe-server-238c28-1 development (development)$ facter -p --no-external-facts | grep -E "(oslogin|[^/]bigbird)"
[2023-03-17 13:28:08.334765 ] ERROR Facter::OptionsValidator - no-external-facts and external-dir options conflict: please specify only one 
root@pe-server-238c28-1 development (development)$ facter -p --no-external-facts --json | grep -E "(oslogin|[^/]bigbird)"
[2023-03-17 13:28:15.077332 ] ERROR Facter::OptionsValidator - no-external-facts and external-dir options conflict: please specify only one 
root@pe-server-238c28-1 development (development)$ facter -p bigbird --no-external-facts | grep -E "(oslogin|[^/]bigbird)"
[2023-03-17 13:28:21.438824 ] ERROR Facter::OptionsValidator - no-external-facts and external-dir options conflict: please specify only one 
root@pe-server-238c28-1 development (development)$ facter -p bigbird --no-external-facts --json | grep -E "(oslogin|[^/]bigbird)"
[2023-03-17 13:28:28.317694 ] ERROR Facter::OptionsValidator - no-external-facts and external-dir options conflict: please specify only one 
root@pe-server-238c28-1 development (development)$  {code}
 

Josh Cooper (Jira)

unread,
Apr 6, 2023, 2:03:02 PM4/6/23
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages