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

update service: only include system_name when specified in options #68

Merged
merged 1 commit into from
Oct 31, 2018

Conversation

eguzki
Copy link
Member

@eguzki eguzki commented Oct 31, 2018

When updating service from source to destination, source system_name is being sent to update destination system_name. This is a problem when updating services within the same tenant, since you would get the following error from API:

{"system_name": ["has already been taken"]}

The fix is: do not try to overwrite system name, unless specified using command's new optional argument with option -t, --target_system_name

@eguzki eguzki requested a review from mikz October 31, 2018 11:24

def initialize (source, source_service_id, destination, target_service_id, insecure)
def initialize (source, source_service_id, destination, target_service_id, insecure, system_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

This starts to be a bit too much.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure!
refactor is coming with new features of the CLI framework :)

def target_service_params(source)
source.select { |k, v| Commands.service_valid_params.include?(k) && v }
target_service = source.select do |k, v|
Commands.service_valid_params.include?(k) \
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be nicer to provider service_valid_update_params that does not have the system_name ?

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 was thinking on that too. But system_name is needed sometimes, and it is a valid attribute of the service.

@eguzki eguzki merged commit a04d717 into master Oct 31, 2018
@eguzki eguzki deleted the fix/update-service-system-name branch October 31, 2018 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants