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

Fixes #34684 - install pulp-cli #252

Merged
merged 5 commits into from Apr 4, 2022
Merged

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented Mar 28, 2022

No description provided.

spec/acceptance/cli_spec.rb Outdated Show resolved Hide resolved
@evgeni
Copy link
Member Author

evgeni commented Mar 28, 2022

EL7 currently fails, as there is no /usr/bin/pulp thanks to the SCL, theforeman/pulpcore-packaging#425 is fixing it.

@evgeni evgeni marked this pull request as ready for review March 28, 2022 09:25
manifests/cli/params.pp Outdated Show resolved Hide resolved
manifests/cli.pp Show resolved Hide resolved
spec/acceptance/cli_spec.rb Outdated Show resolved Hide resolved
Comment on lines +9 to +10
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_package('pulp-cli') }
Copy link
Member Author

Choose a reason for hiding this comment

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

I guess I should add some asserts on the config content too?

@evgeni evgeni force-pushed the pulp-cli branch 8 times, most recently from 7ceb72b to bb27c00 Compare March 29, 2022 09:57
# can be set to specific version number, 'latest', 'present' etc.
#
class pulpcore::cli (
Optional[Stdlib::HTTPUrl] $pulpcore_url = undef,
Copy link
Member Author

Choose a reason for hiding this comment

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

should this default to https://${fqdn}?

Copy link
Member

Choose a reason for hiding this comment

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

It's not exposed to users so I think this is fine.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

This looks good. I do wonder how we're going to present this to users. One thing to consider is to automatically inherit from Foreman. So one solution is how foreman::cli does it: https://github.com/theforeman/puppet-foreman/blob/9e483426c511e7a7a2648c2eaba18f50ac7df8f9/manifests/cli.pp#L39-L50=

That's probably the easiest if we take Kafo into consideration. It should be noted that this approach is compile order dependent (sadly it does exist in Puppet and here you can notice it). That is why the order is defined in the installer config (https://github.com/theforeman/foreman-installer/blob/8d7fb8ef47ffaf1023ffe8ade3db581ed5b1b655/config/foreman.yaml#L34-L37=).

evgeni and others added 3 commits March 29, 2022 14:56
Modern tooling prefers the subjectAltName extension and the CN on a
certificate is considered deprecated. Some tools even complain about
this. However, the -addext command is unavailable on EL7 because openssl
is too old.
@ehelms
Copy link
Member

ehelms commented Mar 29, 2022

I do wonder how we're going to present this to users.

That is a solid question, cause we view this as a bit of advanced functionality when it's deployed in a Katello scenario. I, for example, would be hesistent to make it easy for a user to configure the dry-run (https://github.com/theforeman/puppet-pulpcore/pull/252/files#diff-751b60988fac3d7c7c119b3a70b6f70d6ef0c3facfaf6b9c0c0d44fc564cacb1R25) parameter as this can have severe implications to the system as a whole opened up.

@evgeni
Copy link
Member Author

evgeni commented Mar 30, 2022

The Katello integration of Pulpcore happens via foreman_proxy and foreman_proxy_content modules, this module is not exposed to the users at all (so if they want to modify things, they have to use custom-hiera).

Now, the integration, I think, should be one of these modules including pulpcore::cli and setting the Katello-wanted parameters. Something like:

class { 'pulpcore::cli':
    pulpcore_url => "https://${servername}",
    dry_run => true,
    cert => …,
    key => …,
}

Edit: so like this: theforeman/puppet-foreman_proxy_content#405

#
# === Parameters:
#
# $pulpcore_url:: URL on which Pulpcore runs
Copy link
Member Author

Choose a reason for hiding this comment

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

in other places (foreman_proxy, foreman_proxy_content) we call this pulpcore_api_url.

pulp-cli itself calls it base_url.

🚲 shed?

Copy link
Member

Choose a reason for hiding this comment

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

Given it's not exposed to users, I don't care that much. Let's start with this.

@evgeni
Copy link
Member Author

evgeni commented Mar 31, 2022

Okay, why does status work but user list raise an SSL error?!

),
}

if $manage_root_config and (($username and $password) or ($cert and $key)) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we have some validates above that throw a clean error if for either combo one is supplied and not the other?

Copy link
Member Author

Choose a reason for hiding this comment

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

So in pulp-cli the validation is a bit more involved: https://github.com/pulp/pulp-cli/blob/aa50bc63e949e7f413bce6bc10d323d119e61b09/pulpcore/cli/common/openapi.py#L49-L62

I think for this module, it would be sufficient to check:

  • (username OR password) AND (cert OR key) → error
  • password AND !username → error
  • key AND !cert → error

Everything else is imho valid (like setting username via config, but using CLI --password for the password, or providing a cert/key combo in the cert parameter).

spec/acceptance/cli_spec.rb Outdated Show resolved Hide resolved
spec/acceptance/cli_spec.rb Outdated Show resolved Hide resolved
@ekohl ekohl added the Enhancement New feature or request label Apr 4, 2022
@evgeni
Copy link
Member Author

evgeni commented Apr 4, 2022

@ehelms any further comments, or are you happy with it as it is too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Needs testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants