Add while/until to the for/do rule
Like 'for/do' check that the while/until operator are on the same line with the do. Fixes some pep8 error along the way. Change-Id: I440afe60691263365bf35310bf4212d94f30c339
This commit is contained in:
parent
16dd8b3ed9
commit
86a8e97679
@ -47,7 +47,7 @@ IGNORE = None
|
|||||||
def register_ignores(ignores):
|
def register_ignores(ignores):
|
||||||
global IGNORE
|
global IGNORE
|
||||||
if ignores:
|
if ignores:
|
||||||
IGNORE='^(' + '|'.join(ignores.split(',')) + ')'
|
IGNORE = '^(' + '|'.join(ignores.split(',')) + ')'
|
||||||
|
|
||||||
|
|
||||||
def should_ignore(error):
|
def should_ignore(error):
|
||||||
@ -64,11 +64,15 @@ def print_error(error, line):
|
|||||||
def not_continuation(line):
|
def not_continuation(line):
|
||||||
return not re.search('\\\\$', line)
|
return not re.search('\\\\$', line)
|
||||||
|
|
||||||
|
|
||||||
def check_for_do(line):
|
def check_for_do(line):
|
||||||
if not_continuation(line):
|
if not_continuation(line):
|
||||||
if re.search('^\s*for ', line):
|
match = re.match('^\s*(for|while|until)\s', line)
|
||||||
|
if match:
|
||||||
|
operator = match.group(1).strip()
|
||||||
if not re.search(';\s*do(\b|$)', line):
|
if not re.search(';\s*do(\b|$)', line):
|
||||||
print_error('E010: Do not on same line as for', line)
|
print_error('E010: Do not on same line as %s' % operator,
|
||||||
|
line)
|
||||||
|
|
||||||
|
|
||||||
def check_if_then(line):
|
def check_if_then(line):
|
||||||
|
@ -71,8 +71,7 @@ MODE=""
|
|||||||
ROLE=Member
|
ROLE=Member
|
||||||
USER_NAME=""
|
USER_NAME=""
|
||||||
USER_PASS=""
|
USER_PASS=""
|
||||||
while [ $# -gt 0 ]
|
while [ $# -gt 0 ]; do
|
||||||
do
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help) display_help; exit 0 ;;
|
-h|--help) display_help; exit 0 ;;
|
||||||
--os-username) export OS_USERNAME=$2; shift ;;
|
--os-username) export OS_USERNAME=$2; shift ;;
|
||||||
|
@ -191,8 +191,7 @@ function wait_for_VM_to_halt() {
|
|||||||
domid=$(xe vm-list name-label="$GUEST_NAME" params=dom-id minimal=true)
|
domid=$(xe vm-list name-label="$GUEST_NAME" params=dom-id minimal=true)
|
||||||
port=$(xenstore-read /local/domain/$domid/console/vnc-port)
|
port=$(xenstore-read /local/domain/$domid/console/vnc-port)
|
||||||
echo "vncviewer -via root@$mgmt_ip localhost:${port:2}"
|
echo "vncviewer -via root@$mgmt_ip localhost:${port:2}"
|
||||||
while true
|
while true; do
|
||||||
do
|
|
||||||
state=$(xe_min vm-list name-label="$GUEST_NAME" power-state=halted)
|
state=$(xe_min vm-list name-label="$GUEST_NAME" power-state=halted)
|
||||||
if [ -n "$state" ]; then
|
if [ -n "$state" ]; then
|
||||||
break
|
break
|
||||||
|
@ -42,8 +42,7 @@ EOF
|
|||||||
|
|
||||||
get_params()
|
get_params()
|
||||||
{
|
{
|
||||||
while getopts "hbn:r:l:t:" OPTION;
|
while getopts "hbn:r:l:t:" OPTION; do
|
||||||
do
|
|
||||||
case $OPTION in
|
case $OPTION in
|
||||||
h) usage
|
h) usage
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user