[ 
https://issues.apache.org/jira/browse/KAFKA-2214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Noll updated KAFKA-2214:
--------------------------------
    Description: 
h4. Background

The admin script {{kafka-reassign-partitions.sh}} should integrate better with 
automation tools such as Ansible, which rely on scripts adhering to Unix best 
practices such as appropriate exit codes on success/failure.

h4. Current behavior (incorrect)

When reassignments are still in progress {{kafka-reassign-partitions.sh}} 
prints {{ERROR}} messages but returns an exit code of zero, which indicates 
success.  This behavior makes it a bit cumbersome to integrate the script into 
automation tools such as Ansible.

{code}
$ kafka-reassign-partitions.sh --zookeeper zookeeper1:2181 
--reassignment-json-file partitions-to-move.json --verify

Status of partition reassignment:
ERROR: Assigned replicas (316,324,311) don't match the list of replicas for 
reassignment (316,324) for partition [mytopic,2]
Reassignment of partition [mytopic,0] completed successfully
Reassignment of partition [myothertopic,1] completed successfully
Reassignment of partition [myothertopic,3] completed successfully
...

$ echo $?
0

# But preferably the exit code in the presence of ERRORs should be, say, 1.
{code}

h3. How to improve

I'd suggest that, using the above as the running example, if there are any 
{{ERROR}} entries in the output (i.e. if there are any assignments remaining 
that don't match the desired assignments), then the 
{{kafka-reassign-partitions.sh}}  should return a non-zero exit code.

  was:
h4. Background

The admin script {{kafka-reassign-partitions.sh}} should integrate better with 
automation tools such as Ansible, which rely on scripts adhering to Unix best 
practices such as appropriate exit codes on success/failure.

h4. Current behavior (incorrect)

When reassignments are still in progress {{kafka-reassign-partitions.sh}} 
prints {{ERROR}} messages but returns an exit code of zero, which indicates 
success.  This behavior makes it a bit cumbersome to integrate the script into 
automation tools such as Ansible.

{code}
$ kafka-reassign-partitions.sh --zookeeper zookeeper1:2181 
--reassignment-json-file partitions-to-move.json --verify

Status of partition reassignment:
ERROR: Assigned replicas (316,324,311) don't match the list of replicas for 
reassignment (316,324) for partition [mytopic,2]
Reassignment of partition [mytopic,0] completed successfully
Reassignment of partition [myothertopic,1] completed successfully
Reassignment of partition [myothertopic,3] completed successfully
...

$ echo $?
0

# But preferably the exit code would be, say, 1.
{code}

h3. How to improve

I'd suggest that, using the above as the running example, if there are any 
{{ERROR}} entries in the output (i.e. if there are any assignments remaining 
that don't match the desired assignments), then the 
{{kafka-reassign-partitions.sh}}  should return a non-zero exit code.


> kafka-reassign-partitions.sh --verify should return non-zero exit codes when 
> reassignment is not completed yet
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-2214
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2214
>             Project: Kafka
>          Issue Type: Improvement
>          Components: admin
>    Affects Versions: 0.8.1.1
>            Reporter: Michael Noll
>            Priority: Minor
>
> h4. Background
> The admin script {{kafka-reassign-partitions.sh}} should integrate better 
> with automation tools such as Ansible, which rely on scripts adhering to Unix 
> best practices such as appropriate exit codes on success/failure.
> h4. Current behavior (incorrect)
> When reassignments are still in progress {{kafka-reassign-partitions.sh}} 
> prints {{ERROR}} messages but returns an exit code of zero, which indicates 
> success.  This behavior makes it a bit cumbersome to integrate the script 
> into automation tools such as Ansible.
> {code}
> $ kafka-reassign-partitions.sh --zookeeper zookeeper1:2181 
> --reassignment-json-file partitions-to-move.json --verify
> Status of partition reassignment:
> ERROR: Assigned replicas (316,324,311) don't match the list of replicas for 
> reassignment (316,324) for partition [mytopic,2]
> Reassignment of partition [mytopic,0] completed successfully
> Reassignment of partition [myothertopic,1] completed successfully
> Reassignment of partition [myothertopic,3] completed successfully
> ...
> $ echo $?
> 0
> # But preferably the exit code in the presence of ERRORs should be, say, 1.
> {code}
> h3. How to improve
> I'd suggest that, using the above as the running example, if there are any 
> {{ERROR}} entries in the output (i.e. if there are any assignments remaining 
> that don't match the desired assignments), then the 
> {{kafka-reassign-partitions.sh}}  should return a non-zero exit code.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to