diff mbox series

[kteam-tools] link-to-tracker: add a --re-run commandline option

Message ID 20171012145913.4412-1-juerg.haefliger@canonical.com
State New
Headers show
Series [kteam-tools] link-to-tracker: add a --re-run commandline option | expand

Commit Message

Juerg Haefliger Oct. 12, 2017, 2:59 p.m. UTC
Sometimes it's desirable or necessary to re-run link-to-tracker. Currently
the script bails out if the title of the tracking bug doesn't contain
the string '<version to be filled>' which means the script ran already.
This new commandline option will bypass that check.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 stable/link-to-tracker | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andy Whitcroft Oct. 12, 2017, 3:40 p.m. UTC | #1
On Thu, Oct 12, 2017 at 04:59:13PM +0200, Juerg Haefliger wrote:
> Sometimes it's desirable or necessary to re-run link-to-tracker. Currently
> the script bails out if the title of the tracking bug doesn't contain
> the string '<version to be filled>' which means the script ran already.
> This new commandline option will bypass that check.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  stable/link-to-tracker | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/stable/link-to-tracker b/stable/link-to-tracker
> index 9f4796753bd2..bb31d97391a8 100755
> --- a/stable/link-to-tracker
> +++ b/stable/link-to-tracker
> @@ -179,7 +179,7 @@ class Tracking():
>              found = []
>              for (bugid, tasks_by_name) in found_tasks:
>                  lpbug = s.launchpad.bugs[bugid]
> -                if '<version to be filled>' not in lpbug.title:
> +                if not s.args.re_run and '<version to be filled>' not in lpbug.title:
>                      continue

Should this rather check if the version is <xxxx> _or_ is the version we
are expecting ?

>                  if s.args.sru_cycle and s.bug_to_sru_cycle(lpbug) != s.args.sru_cycle:
>                      continue
> @@ -260,6 +260,7 @@ if __name__ == '__main__':
>      parser.add_argument('--info',  action='store_true', default=False, help='')
>      parser.add_argument('--debug', action='store_true', default=False, help='')
>      parser.add_argument('--dry-run', action='store_true', default=False, help='')
> +    parser.add_argument('--re-run', action='store_true', default=False, help='')
>      parser.add_argument('--sru-cycle', action='store', help='')
>      args = parser.parse_args()

-apw
Juerg Haefliger Oct. 13, 2017, 6:08 a.m. UTC | #2
On 10/12/2017 05:40 PM, Andy Whitcroft wrote:
> On Thu, Oct 12, 2017 at 04:59:13PM +0200, Juerg Haefliger wrote:
>> Sometimes it's desirable or necessary to re-run link-to-tracker. Currently
>> the script bails out if the title of the tracking bug doesn't contain
>> the string '<version to be filled>' which means the script ran already.
>> This new commandline option will bypass that check.
>>
>> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
>> ---
>>  stable/link-to-tracker | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/stable/link-to-tracker b/stable/link-to-tracker
>> index 9f4796753bd2..bb31d97391a8 100755
>> --- a/stable/link-to-tracker
>> +++ b/stable/link-to-tracker
>> @@ -179,7 +179,7 @@ class Tracking():
>>              found = []
>>              for (bugid, tasks_by_name) in found_tasks:
>>                  lpbug = s.launchpad.bugs[bugid]
>> -                if '<version to be filled>' not in lpbug.title:
>> +                if not s.args.re_run and '<version to be filled>' not in lpbug.title:
>>                      continue
> 
> Should this rather check if the version is <xxxx> _or_ is the version we
> are expecting ?

I also had wrong versions in the title that needed cleaning up. I'd
rather not check for a specific version unless this generic override can
have other unwanted side effects.

...Juerg


>>                  if s.args.sru_cycle and s.bug_to_sru_cycle(lpbug) != s.args.sru_cycle:
>>                      continue
>> @@ -260,6 +260,7 @@ if __name__ == '__main__':
>>      parser.add_argument('--info',  action='store_true', default=False, help='')
>>      parser.add_argument('--debug', action='store_true', default=False, help='')
>>      parser.add_argument('--dry-run', action='store_true', default=False, help='')
>> +    parser.add_argument('--re-run', action='store_true', default=False, help='')
>>      parser.add_argument('--sru-cycle', action='store', help='')
>>      args = parser.parse_args()
> 
> -apw
>
Kleber Sacilotto de Souza Oct. 16, 2017, 5:06 p.m. UTC | #3
On 10/12/17 16:59, Juerg Haefliger wrote:
> Sometimes it's desirable or necessary to re-run link-to-tracker. Currently
> the script bails out if the title of the tracking bug doesn't contain
> the string '<version to be filled>' which means the script ran already.
> This new commandline option will bypass that check.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>

It seems a little dangerous at first sight, but running it along with
'--dry-run' should give enough confidence to be renaming the right bug :-).

Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>

> ---
>  stable/link-to-tracker | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/stable/link-to-tracker b/stable/link-to-tracker
> index 9f4796753bd2..bb31d97391a8 100755
> --- a/stable/link-to-tracker
> +++ b/stable/link-to-tracker
> @@ -179,7 +179,7 @@ class Tracking():
>              found = []
>              for (bugid, tasks_by_name) in found_tasks:
>                  lpbug = s.launchpad.bugs[bugid]
> -                if '<version to be filled>' not in lpbug.title:
> +                if not s.args.re_run and '<version to be filled>' not in lpbug.title:
>                      continue
>                  if s.args.sru_cycle and s.bug_to_sru_cycle(lpbug) != s.args.sru_cycle:
>                      continue
> @@ -260,6 +260,7 @@ if __name__ == '__main__':
>      parser.add_argument('--info',  action='store_true', default=False, help='')
>      parser.add_argument('--debug', action='store_true', default=False, help='')
>      parser.add_argument('--dry-run', action='store_true', default=False, help='')
> +    parser.add_argument('--re-run', action='store_true', default=False, help='')
>      parser.add_argument('--sru-cycle', action='store', help='')
>      args = parser.parse_args()
>  
>
Stefan Bader Oct. 17, 2017, 8:42 a.m. UTC | #4
On 12.10.2017 16:59, Juerg Haefliger wrote:
> Sometimes it's desirable or necessary to re-run link-to-tracker. Currently
> the script bails out if the title of the tracking bug doesn't contain
> the string '<version to be filled>' which means the script ran already.
> This new commandline option will bypass that check.
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  stable/link-to-tracker | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/stable/link-to-tracker b/stable/link-to-tracker
> index 9f4796753bd2..bb31d97391a8 100755
> --- a/stable/link-to-tracker
> +++ b/stable/link-to-tracker
> @@ -179,7 +179,7 @@ class Tracking():
>              found = []
>              for (bugid, tasks_by_name) in found_tasks:
>                  lpbug = s.launchpad.bugs[bugid]
> -                if '<version to be filled>' not in lpbug.title:
> +                if not s.args.re_run and '<version to be filled>' not in lpbug.title:
>                      continue
>                  if s.args.sru_cycle and s.bug_to_sru_cycle(lpbug) != s.args.sru_cycle:
>                      continue
> @@ -260,6 +260,7 @@ if __name__ == '__main__':
>      parser.add_argument('--info',  action='store_true', default=False, help='')
>      parser.add_argument('--debug', action='store_true', default=False, help='')
>      parser.add_argument('--dry-run', action='store_true', default=False, help='')
> +    parser.add_argument('--re-run', action='store_true', default=False, help='')
>      parser.add_argument('--sru-cycle', action='store', help='')
>      args = parser.parse_args()
>  
>
diff mbox series

Patch

diff --git a/stable/link-to-tracker b/stable/link-to-tracker
index 9f4796753bd2..bb31d97391a8 100755
--- a/stable/link-to-tracker
+++ b/stable/link-to-tracker
@@ -179,7 +179,7 @@  class Tracking():
             found = []
             for (bugid, tasks_by_name) in found_tasks:
                 lpbug = s.launchpad.bugs[bugid]
-                if '<version to be filled>' not in lpbug.title:
+                if not s.args.re_run and '<version to be filled>' not in lpbug.title:
                     continue
                 if s.args.sru_cycle and s.bug_to_sru_cycle(lpbug) != s.args.sru_cycle:
                     continue
@@ -260,6 +260,7 @@  if __name__ == '__main__':
     parser.add_argument('--info',  action='store_true', default=False, help='')
     parser.add_argument('--debug', action='store_true', default=False, help='')
     parser.add_argument('--dry-run', action='store_true', default=False, help='')
+    parser.add_argument('--re-run', action='store_true', default=False, help='')
     parser.add_argument('--sru-cycle', action='store', help='')
     args = parser.parse_args()