__timezone should be singleton #42
Labels
No Label
bugfix
cleanup
discussion
documentation
doing
done
feature
improvement
packaging
Stale
testing
TODO
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: ungleich-public/cdist#42
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The
__timezone
type should IMHO be a singleton type because it makes no sense to set multiple timezones (I don't know any operating systems on which this would even work.)Such a change cannot be done without breaking current setups.
Would a MR that converts
__timezone
into a singleton type be accepted?closed
Since no one could really come up with a good solution to the transition issue, do you think we can go forward with !916 and add a "breaking changes" section to the changelog?
e.g.
mentioned in merge request !916
This would require cdist core code changes, only for this one type.
What is deprecated here then?
Object id? Or better, type nature?
No, I thought that in the transition, you can use the type like this:
With the first call, it's map the "object id" to the parameter
--timezone
and echos a deprecation warning. After the deprecation is over, only the second call can be used.With this, the "screw up" of the type system only happens in the transition phase and offers a smooth transition for users.
@matze But what should the new type be called?
What's about to only use it while the non-singleton type is deprecated? So you can map the object id to one parameter. Then, every time the singleton type will be called as a normal object, it will map the object id and print a deprecation warning.
After a time, the mapping can be removed. It will be smoother than a temporary type and maybe a lesser hack than generally support an positional argument for singletons. Without a warning, it may be confused why singletons have an object id.
When I think more about it we shouldn't hack singleton type core support.
But we should decide on the way of deprecation and replacing the old one with the new one.
With singleton types you cannot call it object id, since there can be only one singleton type object.
I know, it's kind of a hack, but there is already only one positional argument allowed for non-singleton types, and that's object id.
So there would only be one positional argument allowed and only for singleton types?
@nico Hm... what if we can support positional parameter for singleton types? It wouldn't be object id but plain positional parameter, optional.
It's just that we would need to support it with some env var like object id is currently supported, like
__singleton_arg
. Does this sound good to you?This way existing
__timezone
would not break current configurations.It could also simplify/make more natural some future singleton types that require one argument.
but can't we allow object_id-s with singletons?
The problem here is, we cannot really offer a transition path to the users. We can warn that it will break and then.. what? I have to continue using non-singleton until upstream switched to singleton.
So I certainly will be broken and I cannot do anything. That is not a good user experience.
What we could do is something like this:
__timezonetmp
as a singleton__timezonetmp
Also not a great user experience.
I wonder if we can offer something better, because this is basically a non-feature change that will cause people to migrate.
We could also say we copy
__timezone
to__timezone_another_name
as a singleton and make this the default one.Anyway, you get the picture.
Maybe we should queue the change for an upcoming 7.0.0 release?
IMO breaking API changes are okay for major releases.
You are right, it should have been a singleton. I'm not sure what's the
best path here for change, as we would need a second type if we want to
give users the opportunity to modify their code without breaking.
Hm...didn't think about the object id.
Singleton change which requires parameter would break existing configurations.
We should probably go with deprecation and eventually change it to something like
__timezone --tz Europe/Talling
?@nico What is your opinion on this one?
I think it was done probably because it's nicer to write
__timezone Europe/Tallinn
vs__timezone --timezone Europe/Tallinn
.maybe allow object_id if singleton? @poljakowski
yes