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 #33750 - Make katello commands work without Puppet #818

Merged
merged 1 commit into from Oct 27, 2021

Conversation

ofedoren
Copy link
Contributor

@ehelms, could you please test this out?

@theforeman-bot
Copy link

Issues: #33750

@ehelms
Copy link
Member

ehelms commented Oct 21, 2021

Thank you for tackling this!

Running the bats tests I see better output but a few failures still:

ok 1 Create an Empty Organization
ok 2 create an Organization
ok 3 create a product
ok 4 create package repository
ok 5 upload package
ok 6 sync repository
ok 7 create a file repository
ok 8 sync file repository
ok 9 fetch file from file repository
ok 10 create a container repository
ok 11 sync container repository
ok 12 # skip (Puppet content is not available in scenarios with only Pulp 3) create puppet repository
ok 13 # skip (Puppet content is not available in scenarios with only Pulp 3) upload puppet module
ok 14 create lifecycle environment
ok 15 create content view
ok 16 add yum repo to content view
ok 17 publish content view
not ok 18 promote content view
# (in test file fb-katello-content.bats, line 115)
#   `hammer content-view version promote  --organization="${ORGANIZATION}" \' failed with status 64
# Could not promote the content view:
#   Missing arguments for '--id'.
ok 19 export content view version
ok 20 create skeleton org for import
ok 21 import the exported content view
ok 22 compare contents of export and import
ok 23 export the library
ok 24 create org for library import
ok 25 import the library to the new organization
ok 26 compare contents of library export and import
ok 27 publish content view again
ok 28 perform an incremental export
ok 29 perform an incremental library export
not ok 30 create activation key
# (in test file fb-katello-content.bats, line 254)
#   `--unlimited-hosts | grep -q "Activation key created"' failed
# Could not create the activation key:
#   Error: Unrecognised option '--lifecycle-environment'.
#   
#   See: 'hammer activation-key create --help'.
not ok 31 disable auto-attach
# (in test file fb-katello-content.bats, line 258)
#   `hammer activation-key update --organization="${ORGANIZATION}" \' failed with status 70
# Could not update the activation key:
#   Error: activation_key not found.
not ok 32 add subscription to activation key
# (in test file fb-katello-content.bats, line 265)
#   `--name="${ACTIVATION_KEY}" | cut -d, -f2)' failed with status 70
# Error: activation_key not found.
ok 33 # skip (Puppet content is not available in scenarios with only Pulp 3) add puppet module to content view
not ok 34 promote first content view again
# (in test file fb-katello-content.bats, line 283)
#   `hammer content-view version promote  --organization="${ORGANIZATION}" \' failed with status 64
# Could not promote the content view:
#   Missing arguments for '--id'.
ok 35 create and sync modules-rpms repo
ok 36 create and sync rpm-deps repo
ok 37 create first component content view
ok 38 add yum and docker repos to first component content view
ok 39 add errata exclude filter to first component content view
ok 40 add package exclude filter to first component content view
ok 41 add module include filter to first component content view
ok 42 publish first component content view
ok 43 create composite content view
not ok 44 publish and promote composite content view
# (in test file fb-katello-content.bats, line 369)
#   `hammer content-view version promote --organization="${ORGANIZATION}" \' failed with status 64
# Task f0978140-f85f-4ee7-a143-07eaba045a88 running: 0.0/1, 0%, elapsed: 00:00:00
# Task f0978140-f85f-4ee7-a143-07eaba045a88 running: 0.58/1, 57%, 0.2/s, elapsed: 00:00:02, ETA: 00:00:01
# Task f0978140-f85f-4ee7-a143-07eaba045a88 running: 0.86/1, 86%, 0.2/s, elapsed: 00:00:04
# Task f0978140-f85f-4ee7-a143-07eaba045a88 success: 1.0/1, 100%, 0.1/s, elapsed: 00:00:06
# Task f0978140-f85f-4ee7-a143-07eaba045a88 success: 1.0/1, 100%, 0.1/s, elapsed: 00:00:06
# Could not promote the content view:
#   Missing arguments for '--id'.
ok 45 incremental update first component cv with composite propagation
ok 46 ensure component cv 1 version 1.1 has proper environments
not ok 47 ensure composite cv version 1.1 has proper environments
# (in test file fb-katello-content.bats, line 395)
#   `echo $envs_found | grep -q -E "Name:\s+${LIFECYCLE_ENVIRONMENT}"' failed
ok 48 ensure component cv 1 latest version has proper content
ok 49 ensure component cv 2 latest version has proper content
ok 50 ensure composite cv latest version has proper content
ok 51 fetch rpm from yum repository on old path

@ofedoren
Copy link
Contributor Author

@ehelms, sorry for the delay, updated.

Could you please test this out for both flows: with Puppet and without Puppet? Or, if you don't have time, please send me your steps how to configure the test env and run the tests for those flows. I've tried what you suggested, but for some reason Katello is not being installed there...

@ehelms
Copy link
Member

ehelms commented Oct 26, 2021

Getting better! Down to this failure now:

    not ok 30 create activation key
    # (in test file fb-katello-content.bats, line 254)
    #   `--unlimited-hosts | grep -q "Activation key created"' failed
    # Could not create the activation key:
    #   Error: lifecycle_environment not found.

@ofedoren ofedoren force-pushed the bug-33750-fix-katello-wo-puppet branch from 7f444f1 to 2747168 Compare October 26, 2021 19:40
@ofedoren
Copy link
Contributor Author

Getting better! Down to this failure now:

My apologies 🤦 The logic in this plugin is not so straightforward and it's not easy to debug without context and usage knowledges. This needs to be refactored and we need to get rid of search_options_creators abuse, since the id resolver contains a lot of automation already and those changes can lead to unexpected behaviour. This is on my TODO already 🙃

One more test round 🚀

@ehelms
Copy link
Member

ehelms commented Oct 26, 2021

Tested again and still hitting the issue. What it looks like is happening is:

The code does a fetch on environments but passes the name of the activation key as the name parameter rather than passing the name of the lifecycle-environment that was input on the command. The command run is:

hammer --debug activation-key create --organization="Test Organization" --name="Test AK" --content-view="Test CV" --lifecycle-environment="Test" --unlimited-hosts
[ INFO 2021-10-26T23:15:46 API] GET /katello/api/organizations/4/environments
[DEBUG 2021-10-26T23:15:46 API] Params: {
       "name" => "Test AK",
    :per_page => 1000,
        :page => 1
}
[DEBUG 2021-10-26T23:15:46 API] Headers: {
    :params => {
           "name" => "Test AK",
        :per_page => 1000,
            :page => 1
    }
}
[DEBUG 2021-10-26T23:15:46 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[DEBUG 2021-10-26T23:15:46 API] Response: {
       "total" => 0,
    "subtotal" => 0,
        "page" => "1",
    "per_page" => "1000",
       "error" => nil,
      "search" => nil,
        "sort" => {
           "by" => "name",
        "order" => "asc"
    },
     "results" => []
}

@ofedoren
Copy link
Contributor Author

This is weird, and I have no idea what's going on... I've tested this command and this should fix that. Also, I've tried now with and without Puppet, and it seems to pass everything just fine:
ScreenShot-1635338135640
ScreenShot-1635338151692

@ehelms
Copy link
Member

ehelms commented Oct 27, 2021

@ofedoren Let me take it for another test drive, there is a possibility I somehow had stale code so I will do everything fresh.

@ehelms
Copy link
Member

ehelms commented Oct 27, 2021

This worked for me! I must have had a bad environment the first time.

Copy link
Member

@ehelms ehelms left a comment

Choose a reason for hiding this comment

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

This worked for me in testing in the right scenario. @chris1984 could you take a look as a maintainer code and functionality wise? This is blocking merging some turning Puppet off by default work so I would appreciate priority on it.

@chris1984
Copy link
Member

This worked for me in testing in the right scenario. @chris1984 could you take a look as a maintainer code and functionality wise? This is blocking merging some turning Puppet off by default work so I would appreciate priority on it.

@ehelms sure will look after standup

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

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

ACK it looks good, the only comment I had was around the legacy_option_id/s method name, if we could name that something better to know what it used to be part of, but git blame can see this pr and I can't really think of something better at the moment, I don't want to block Eric's stuff. Thank you for adding test coverage back as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants