Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow fetching REX keys from the API #282

Merged
merged 1 commit into from
Jan 25, 2019
Merged

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented Dec 18, 2018

this requires REX 1.6.7 or newer to be installed

includes #281

so far untested :)

@fcami
Copy link
Contributor

fcami commented Dec 18, 2018

Not tested either, but that's the right way to do it. LGTM!

@evgeni evgeni force-pushed the rex-api branch 2 times, most recently from 2693368 to 492f5cf Compare December 18, 2018 12:01
if options.remote_exec_proxies:
listproxies = options.remote_exec_proxies.split(",")
for proxy_fqdn in listproxies:
remote_exec_url = "https://" + str(proxy_fqdn) + ":9090/ssh/pubkey"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not great if we ever move around the smart proxy port or someone configures it differently. Fine to keep, worth noting.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, will add to the longish "refactor&improve" list :)

"""
Download and install all Foreman's SSH public keys.
"""
url = "https://" + options.foreman_fqdn + ":" + str(API_PORT) + "/api/v2/smart_proxies/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use some apypie love (if it wasn't designed as a stand-alone script to install).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bootstrap.py has to run on python with only stdlib available :/

Copy link
Member

@sideangleside sideangleside left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of questions:

  • if this requires a specific version of REX, is there any way to check for that version and fail gracefully if not?
  • Doesn't the API require auth for most things? so wouldn't you have to ensure that the user has authenticated when using this capability?

@evgeni
Copy link
Member Author

evgeni commented Dec 18, 2018

if this requires a specific version of REX, is there any way to check for that version and fail gracefully if not?

I can look into this. But the code will fail gracefully anyways, as in older versions there would be just no key listed, and then we don't add it. But we also don't tell the user that we didn't.

Doesn't the API require auth for most things? so wouldn't you have to ensure that the user has authenticated when using this capability?

Correct, this only works if you pass user/password. Want me to add a check for that?

@ehelms
Copy link
Member

ehelms commented Jan 7, 2019

Needs an ole rebase!

@evgeni
Copy link
Member Author

evgeni commented Jan 7, 2019

rebased

this requires REX 1.6.7 or newer to be installed
@evgeni evgeni merged commit d405279 into Katello:master Jan 25, 2019
@evgeni evgeni deleted the rex-api branch January 25, 2019 11:32
evgeni added a commit to evgeni/katello-client-bootstrap that referenced this pull request Mar 8, 2019
* Bugfix for REX authorized_keys permission handling (Katello#298)
* Improve error message and allow non-existing files for --rex-authpath (Katello#299)
* Improve --rex-urlkeyfile help text (Katello#293)
* Default bootstrap.py to install katello-host-tools and omit the katello-agent package (Katello#258)
* Improve output when using the rex options (Katello#291)
* Don't fail if yum clean fails (Katello#289)
* Don't use json.loads to generate dicts (Katello#288)
* Bugfix: don't build a newly created host (Katello#287)
* Call rhn-migrate-classic-to-rhsm with --remove-rhn-packages (Katello#137)
* Allow fetching REX keys from the API (Katello#282)
@evgeni evgeni mentioned this pull request Mar 8, 2019
evgeni added a commit that referenced this pull request Mar 12, 2019
* Bugfix for REX authorized_keys permission handling (#298)
* Improve error message and allow non-existing files for --rex-authpath (#299)
* Improve --rex-urlkeyfile help text (#293)
* Default bootstrap.py to install katello-host-tools and omit the katello-agent package (#258)
* Improve output when using the rex options (#291)
* Don't fail if yum clean fails (#289)
* Don't use json.loads to generate dicts (#288)
* Bugfix: don't build a newly created host (#287)
* Call rhn-migrate-classic-to-rhsm with --remove-rhn-packages (#137)
* Allow fetching REX keys from the API (#282)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants