Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

feat(fleetctl): add template unit support to fleetctl start/submit #480

Merged
merged 1 commit into from
Jun 4, 2014

Conversation

jonboulle
Copy link
Contributor

Building on #475 and #479, this is a first pass at adapting fleetctl to support creation of instance units based on template units already stored in the Registry

@jonboulle
Copy link
Contributor Author

Any comments on this one?

@bcwaldon
Copy link
Contributor

@jonboulle What about the case where you have a template unit locally, but you want to start an instance of it without first submitting that template?

@jonboulle
Copy link
Contributor Author

fixed

if err != nil {
return fmt.Errorf("failed getting Unit(%s) from file: %v", jobName, err)
log.V(1).Infof("Error retrieving template Job(%s) from Registry: %v", uni.Template, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

This change doesn't make sense to me. Why are we continuing operation if we encountered an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See lines 397-398 - this is existing behaviour

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bcwaldon see #520 - if that looks better I'll rebase this on that and follow that behaviour.

Copy link
Contributor

Choose a reason for hiding this comment

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

lgtm'd it

@jonboulle
Copy link
Contributor Author

Reee baysed

if err != nil {
return fmt.Errorf("failed getting Unit(%s) from file: %v", jobName, err)
return fmt.Errorf("Error retrieving template Job(%s) from Registry: %v", uni.Template, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

error strings should be lowercase

@bcwaldon
Copy link
Contributor

bcwaldon commented Jun 4, 2014

functionally looks fine, just getting picky about things

@jonboulle
Copy link
Contributor Author

The whole point of this (and #520) was to undo that change! 😕

@bcwaldon
Copy link
Contributor

bcwaldon commented Jun 4, 2014

I'm confused. Can we discuss in person?

@jonboulle
Copy link
Contributor Author

Chief Picky Officer B. Waldon of the 1st Fleet Battalion

@bcwaldon
Copy link
Contributor

bcwaldon commented Jun 4, 2014

Reporting for duty.

@jonboulle
Copy link
Contributor Author

Once we have a logo I am going to get you a sailor cap

@jonboulle
Copy link
Contributor Author

Lowercasefied errors and squashed.

return 1
}
}
if err := lazyCreateJobs(args, sharedFlags.Sign); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually an important change. The code you're replacing fails if it cannot create a job. Now if someone makes a change to a local unit and calls fleetctl submit X, the command will succeed, and could be misleading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, but a) we do warn about this explicitly:

  This operation is idempotent; if a named unit already exists in the cluster, it will not be resubmitted.

and b), this is the behaviour today for fleetctl start foo.service && vi foo.service && fleetctl start foo.service; I don't think it's any less misleading there.

So we should take this opportunity to solve for both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously I'd thought about adding a check - if a unit already exists in the registry and locally, compare hashes and print a warning to the user. Thoughts? (Would do that as a subsequent change, not here)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that comparison/warning would be great.

@bcwaldon
Copy link
Contributor

bcwaldon commented Jun 4, 2014

lgtm

@jonboulle
Copy link
Contributor Author

Merging this and will follow up with warning.

jonboulle added a commit that referenced this pull request Jun 4, 2014
feat(fleetctl): add template unit support to fleetctl start/submit
@jonboulle jonboulle merged commit 410a0d0 into coreos:master Jun 4, 2014
@jonboulle jonboulle deleted the template_units3 branch June 4, 2014 23:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants