Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

simianfacter/Facter 4 issue #61

Open
arubdesu opened this issue Feb 9, 2017 · 7 comments
Open

simianfacter/Facter 4 issue #61

arubdesu opened this issue Feb 9, 2017 · 7 comments

Comments

@arubdesu
Copy link

arubdesu commented Feb 9, 2017

Immediate traceback with cfacter and simianfacter the moment it hits the new structured fact output:

Traceback (most recent call last):
  File "/usr/local/bin/simianfacter", line 102, in <module>
    main()
  File "/usr/local/bin/simianfacter", line 87, in main
    facts = GetFacterFacts()
  File "/usr/local/bin/simianfacter", line 69, in GetFacterFacts
    (key, unused_sep, value) = line.split(' ', 2)

I'm working on a PR, just submitting this in case someone beats me to it with how y'all solved this internally... 😉

@arubdesu
Copy link
Author

Closing, more recent commits could have resolved this.

@arubdesu
Copy link
Author

Recent commits have not fixed this, and the existing code fails with an error (that gets swallowed and therefore isn't visible on stdout...) related to argparse. This cannot be what you're using internally... anyway, my version is here. Would a PR be good?

@arubdesu arubdesu reopened this Jan 22, 2018
@maximermilov
Copy link
Contributor

and the existing code fails with an error

Can you provide traceback?

You can run it directly "/usr/local/bin/simianfacter -j"

Would a PR be good?

of course, but your version can't output json(current default).

@arubdesu
Copy link
Author

arubdesu commented Jan 22, 2018

Hey @maximermilov,

$ sudo /usr/local/munki/simian/bin/python src/simian/util/simianfacter -j
Traceback (most recent call last):
  File "simianfacter_from_", line 114, in <module>
    main()
  File "src/simian/util/simianfacter", line 92, in main
    help='output JSON')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/argparse.py", line 1294, in add_argument
    action = action_class(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'type'

Pardon that I'm not sure why it needs to output json... my issue trying to integrate any version past 2.4.x last year was that my custom site fact wasn't being picked up. I see it in the json output, but it's not integrated into the managedsoftwareupdate run for whatever reason, so I lose the testing track and don't get site-specific manifest modifications.

@maximermilov
Copy link
Contributor

Seems you have local modification to the script, because
https://github.com/google/simian/blob/master/src/simian/util/simianfacter#L92
don't have 'type' argument.

@arubdesu
Copy link
Author

😅 Well that was an errant issue that maybe was never in any checkout, but even with that exact file it's definitely something else amiss that's causing a whole bunch of values to be dropped in https://github.com/google/simian/blob/8675db57c78abf7cbbd254e3ff0aa47a1d8134ea/src/simian/mac/client/flight_common.py#L411-L522
if I add a print statement before that ending line of the function, 522, and run it with my simianfacter I get:

    preflight stdout: {'uptime': 6647.569639921188, 'root_disk_free': 25364717568, 'uuid': 'blahuuid', 'user_disk_free': 25364717568, 'track': 'unstable', 'hostname': 'foo_hostname', 'runtype': 'custom', 'site': 'MTV', 'os_version': '10.13.3', 'on_corp': '1', 'owner': 'allister', 'mgmt_enabled': True, 'serial': 'C02T123ABC', 'last_notified_datetime': None, 'client_version': u'3.1.1.3447 simian-2.5', 'config_track': '', 'applesus': 'True'}

notice simiantrack and configtrack are populated. When I switch in master's version of simianfacter, I get NONE and configtrack BROKEN. For background, I'm using all this with facter 3.6.3 (commit 194e2f2f324aba6a1262f37ad02841383ab7f961).

@arubdesu
Copy link
Author

arubdesu commented Feb 7, 2018

What creates /Library/Managed\ Installs/facter.cache? Was that code supposed to have been purged?
This is driving me nuts, I've lost all site and track functionality, and when I run in debug mode it magically returns for a few runs before breaking again. simianfacter also throws out results if facter has an error, but that functionally just returns a None for the one desired fact, so it shouldn't matter.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants