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 #5967 - initial updates to support default capsule #4214

Merged
merged 1 commit into from Jun 5, 2014

Conversation

bbuckingham
Copy link
Member

This commit contains several changes to support a 'default' capsule.
With each fortello installation, there will be a capsule installed.
That capsule will not provide pulp node functionality, since pulp
functionality is provided by the pulp server running on the fortello
server; however, it can provide other features such as puppet, dhcp...etc.

With these changes, the 'default' capsule will be automatically associated
with the following resources:

  • all organizations configured on the fortello server
  • the default location
  • all lifecycle environments

In addition, it will not be allowed for a user to perform CLI commands
which would alter the 'default' capsule. For example, the following commands
would generate an error:

  • capsule content add-lifecycle-environment
  • capsule content remove-lifecycle-environment
  • capsule content synchronize

That said, a user could still look to see details on the 'default'
capsule using the other supported CLI commands such as:

  • capsule list
  • capsule content info
  • capsule content lifecycle-environments

With the above, this 'default' capsule can then be used to help
support things like:

  • When a puppet environment is created as part of publishing
    or promoting a content view, associate that puppet environment
    with the appropriate locations. This would be achieved by
    retrieving the list of locations that are associated with
    capsules that are currently syncing content for the
    target lifecycle environment.

# 3. puppet classes
content_view.repos(env).each { |repo| Medium.update_media(repo) }

unless content_view.default?
foreman_environment = Environment.find_or_create_by_katello_id(org, env, content_view)

# Retrieve the list of capsules associated with the target org+env
Copy link
Member

Choose a reason for hiding this comment

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

What about using CapsuleContent.with_environment(env)

@iNecas
Copy link
Member

iNecas commented Jun 4, 2014

Haven't tested it yet, but the code looks good, just some minor comments.

@bbuckingham
Copy link
Member Author

@iNecas, thanks for the comments! PR updated.

@iNecas
Copy link
Member

iNecas commented Jun 4, 2014

ACK

@@ -133,6 +134,11 @@ def create_redhat_provider
self.providers << Katello::Provider.new(:name => "Red Hat", :provider_type => Katello::Provider::REDHAT)
end

def associate_default_capsule
capsule_content = CapsuleContent.default_capsule
capsule_content.capsule.organizations << self if capsule_content
Copy link
Member

Choose a reason for hiding this comment

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

Does the capsule object here actually get saved?

Copy link
Member

Choose a reason for hiding this comment

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

I guess it would due to the relationship?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, relationships with << save automatically, thank you Rails for the consistency :sarcasmface:

This commit contains several changes to support a 'default' capsule.
With each fortello installation, there will be a capsule installed.
That capsule will not provide pulp node functionality, since pulp
functionality is provided by the pulp server running on the fortello
server; however, it can provide other features such as puppet, dhcp...etc.

With these changes, the 'default' capsule will be automatically associated
with the following resources:
- all organizations configured on the fortello server
- the default location
- all lifecycle environments

In addition, it will not be allowed for a user to perform CLI commands
which would alter the 'default' capsule. For example, the following commands
would generate an error:
- capsule content add-lifecycle-environment
- capsule content remove-lifecycle-environment
- capsule content synchronize

That said, a user could still look to see details on the 'default'
capsule using the other supported CLI commands such as:
- capsule list
- capsule content info
- capsule content lifecycle-environments

With the above, this 'default' capsule can then be used to help
support things like:
- When a puppet environment is created as part of publishing
  or promoting a content view, associate that puppet environment
  with the appropriate locations.  This would be achieved by
  retrieving the list of locations that are associated with
  capsules that are currently syncing content for the
  target lifecycle environment.
@jlsherrill
Copy link
Member

@bbuckingham I'm assuming this does not handle changing the puppet environments's locations if the user add or removes locations from the capsule? Can we open an issue on that if not?

@bbuckingham
Copy link
Member Author

@jlsherrill, good point. Created the following redmine issue to add that functionality: http://projects.theforeman.org/issues/6074

@jlsherrill
Copy link
Member

ACK fro me

bbuckingham added a commit that referenced this pull request Jun 5, 2014
fixes #5967 - initial updates to support default capsule
@bbuckingham bbuckingham merged commit e9290be into Katello:master Jun 5, 2014
@bbuckingham bbuckingham deleted the issue-5967 branch June 5, 2014 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants