Merge lp:~1chb1n/ubuntu-openstack-ci/use-port-cleanup-tool into lp:ubuntu-openstack-ci

Proposed by Ryan Beisner
Status: Merged
Merged at revision: 389
Proposed branch: lp:~1chb1n/ubuntu-openstack-ci/use-port-cleanup-tool
Merge into: lp:ubuntu-openstack-ci
Diff against target: 836 lines (+196/-227)
19 files modified
.bzrignore (+1/-0)
common/osci_utils.py (+4/-4)
job-parts/build_deploy_test.sh (+1/-1)
job-parts/build_deployer_quickcheck.sh (+1/-1)
job-parts/build_git_deploy_test.sh (+1/-1)
job-parts/build_juju_deploy_single_charm.sh (+2/-2)
job-parts/build_mojo_runner.sh (+9/-5)
job-parts/build_osi.sh (+1/-1)
job-parts/deprecated/Z_DEPRECATE_build_mojo_runner_baremetal.sh (+0/-69)
job-parts/deprecated/part_juju_cleanup.sh (+0/-22)
job-parts/juju1_bighammer_destroy.sh (+32/-27)
job-parts/juju1_deploy_ok.sh (+45/-35)
job-parts/osci_job_common.sh (+33/-16)
job-parts/osci_mojo_common.sh (+21/-35)
job-parts/trigger_by_mojo_group.sh (+6/-0)
populate/mappings.yaml (+9/-7)
tools/juju_status_health_check.py (+1/-1)
tools/requirements.txt (+10/-0)
tools/tox.ini (+19/-0)
To merge this branch: bzr merge lp:~1chb1n/ubuntu-openstack-ci/use-port-cleanup-tool
Reviewer Review Type Date Requested Status
Andrew McLeod (community) Approve
Review via email: mp+316399@code.launchpad.net

Commit message

Update cleanup; use mojo from a venv; add ocata mapping

 - Use port-cleanup tool to delete neutron ext-ports left over from mojo runs. [Bug 1656306]
 - Update and re-enable undercloud instance reaping when error conditions are known. [Bug 1668778]
 - Block forever when destroy fails and cleanup fails, where human intervention is required anyway. [Bug 1668778]
 - Use mojo from a python virtualenv. [Bug 1666746]
 - Use python virtualenv for juju_status_health_check to work around paramiki/crypto IV CTR issues upstream. [Bug 1665598]

Description of the change

Update cleanup; use mojo from a venv; add ocata mapping

 - Use port-cleanup tool to delete neutron ext-ports left over from mojo runs. [Bug 1656306]
 - Update and re-enable undercloud instance reaping when error conditions are known. [Bug 1668778]
 - Block forever when destroy fails and cleanup fails, where human intervention is required anyway. [Bug 1668778]
 - Use mojo from a python virtualenv. [Bug 1666746]
 - Use python virtualenv for juju_status_health_check to work around paramiki/crypto IV CTR issues upstream. [Bug 1665598]

To post a comment you must log in.
Revision history for this message
Ryan Beisner (1chb1n) wrote :

Here is this in action in OSCI:
http://pastebin.ubuntu.com/23931679/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

Example of blocking forever w/o cleanup:
http://pastebin.ubuntu.com/24086467/

Example of automatically cleaning up that same type of error condition:
http://pastebin.ubuntu.com/24086472/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

# Example of automatic ERROR instance cleanup:
http://pastebin.ubuntu.com/24086476/

Revision history for this message
Ryan Beisner (1chb1n) wrote :

NOTE: UOSCI is running live on this branch and has been running on it since Feb 10.

406. By Ryan Beisner

Check that mojo manifest file exists before bootstrapping

407. By Ryan Beisner

Express or-true consistently in juju1* tools

Revision history for this message
Andrew McLeod (admcleod) wrote :

[Bug 1656306] - approve this MR on basis that a fix is released for this bug and confirmed functional
[Bug 1668778] - approve although this bug has not been 'fix released' it has been tested OK
[Bug 1666746] - approve, fix released and workaround validated
[Bug 1665598] - approve, fix released and validated by another user

On the basis of the notes for these bugs and a review of the diff below I give my +1 for this MR.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2016-08-31 01:07:46 +0000
3+++ .bzrignore 2017-03-01 03:45:48 +0000
4@@ -17,3 +17,4 @@
5 temp.py
6 .coverage
7 deployment/deploy-files/novarc-artifactcloud
8+*/.tox
9
10=== modified file 'common/osci_utils.py'
11--- common/osci_utils.py 2016-03-02 00:10:08 +0000
12+++ common/osci_utils.py 2017-03-01 03:45:48 +0000
13@@ -586,7 +586,7 @@
14 # Resolve if possible
15 try:
16 _host = socket.gethostbyname(host)
17- except socket.error, e:
18+ except socket.error as e:
19 logging.debug('Unable to resolve address: '
20 '{} ({}) Trying anyway!'.format(host, e))
21 _host = host
22@@ -606,7 +606,7 @@
23 logging.debug('Socket connect OK for host '
24 '{} on port {}.'.format(host_str, port))
25 return True
26- except socket.error, e:
27+ except socket.error as e:
28 logging.debug('Socket connect FAIL for'
29 ' {} port {} ({})'.format(host_str, port, e))
30 return False
31@@ -642,13 +642,13 @@
32 logging.debug('SSH expected: {}'.format(expected))
33 logging.debug('SSH stdout: {}'.format(stdout_lines))
34 logging.debug('SSH stderr: {}'.format(stderr_lines))
35- except paramiko.ssh_exception.SSHException, e:
36+ except paramiko.ssh_exception.SSHException as e:
37 logging.error('SSH session connect FAILED for host '
38 '{} ({})'.format(host, e))
39 if mpq:
40 mpq.put(False)
41 return False
42- except socket.error, e:
43+ except socket.error as e:
44 logging.error('SSH socket connect FAIL for'
45 ' {} ({})'.format(host, e))
46 if mpq:
47
48=== modified file 'job-parts/build_deploy_test.sh'
49--- job-parts/build_deploy_test.sh 2016-06-13 10:21:46 +0000
50+++ job-parts/build_deploy_test.sh 2017-03-01 03:45:48 +0000
51@@ -26,7 +26,7 @@
52
53 # Confirm deployment, configure it, run tempest smoke
54 f_line "Confirm deployment"
55-juju_ok="$(${OSCI_ROOT}/job-parts/juju_deploy_ok.sh ||:)"
56+juju_ok="$(${OSCI_ROOT}/job-parts/juju1_deploy_ok.sh ||:)"
57 echo $juju_ok
58 f_juju_status_health_check "-post-deploy"
59
60
61=== modified file 'job-parts/build_deployer_quickcheck.sh'
62--- job-parts/build_deployer_quickcheck.sh 2016-06-13 10:21:46 +0000
63+++ job-parts/build_deployer_quickcheck.sh 2017-03-01 03:45:48 +0000
64@@ -20,7 +20,7 @@
65
66 # Confirm deployment
67 f_line "Confirm deployment"
68-juju_ok="$(${OSCI_ROOT}/job-parts/juju_deploy_ok.sh ||:)"
69+juju_ok="$(${OSCI_ROOT}/job-parts/juju1_deploy_ok.sh ||:)"
70 echo $juju_ok
71 f_juju_status_health_check "-post-deploy"
72
73
74=== modified file 'job-parts/build_git_deploy_test.sh'
75--- job-parts/build_git_deploy_test.sh 2016-06-13 10:21:46 +0000
76+++ job-parts/build_git_deploy_test.sh 2017-03-01 03:45:48 +0000
77@@ -30,7 +30,7 @@
78
79 # Confirm deployment, configure it, run tempest smoke
80 f_line "Confirm deployment"
81-juju_ok="$(${OSCI_ROOT}/job-parts/juju_deploy_ok.sh ||:)"
82+juju_ok="$(${OSCI_ROOT}/job-parts/juju1_deploy_ok.sh ||:)"
83 echo $juju_ok
84 f_juju_status_health_check "-post-deploy"
85
86
87=== modified file 'job-parts/build_juju_deploy_single_charm.sh'
88--- job-parts/build_juju_deploy_single_charm.sh 2016-06-13 10:21:46 +0000
89+++ job-parts/build_juju_deploy_single_charm.sh 2017-03-01 03:45:48 +0000
90@@ -17,14 +17,14 @@
91 f_juju_wait
92
93 # Wait and check
94-ready="$(${OSCI_ROOT}/job-parts/juju_deploy_ok.sh ||:)"
95+ready="$(${OSCI_ROOT}/job-parts/juju1_deploy_ok.sh ||:)"
96 tries=0
97 while [[ "$ready" != *DEPLOYED:* ]] && [ $tries -le 20 ]
98 do
99 echo "Waiting for environment state to become started/ACTIVE..."
100 echo "${ready}"
101 sleep 30
102- ready="$(${OSCI_ROOT}/job-parts/juju_deploy_ok.sh ||:)"
103+ ready="$(${OSCI_ROOT}/job-parts/juju1_deploy_ok.sh ||:)"
104 tries=$(( $tries + 1 ))
105 done
106
107
108=== modified file 'job-parts/build_mojo_runner.sh'
109--- job-parts/build_mojo_runner.sh 2016-12-09 18:14:03 +0000
110+++ job-parts/build_mojo_runner.sh 2017-03-01 03:45:48 +0000
111@@ -25,18 +25,18 @@
112 # Source the common functions
113 . ${OSCI_ROOT}/job-parts/osci_job_common.sh
114
115-# Confirm executable works and announce version
116-echo "Mojo version:"
117-mojo --version
118-
119 # Set common, constant mojo workspace and project names
120-export MOJO_WORKSPACE_NAME="osci-mojo"
121+export MOJO_WKSP="osci-mojo"
122 export MOJO_PROJ="mojo-openstack-specs"
123+export MOJO_ROOT="$(mktemp -d)"
124
125 # Prep environment
126 f_fresh_clean_start
127 f_env_no_pass
128
129+f_tool_refresh_bot_control
130+f_mojo_create_venv
131+
132 f_line "validating mojo runner env vars"
133 f_mojo_handle_env_vars
134
135@@ -46,6 +46,10 @@
136 f_line "defining new mojo workspace"
137 f_mojo_new_workspace
138
139+f_line "check that mojo spec manifest exists"
140+MOJO_MANIFEST_FILE=${MOJO_ROOT}/${MOJO_PROJ}/${MOJO_SERIES}/${MOJO_WKSP}/spec/${MOJO_SPEC}/manifest
141+ls -alh $MOJO_MANIFEST_FILE
142+
143 f_line "bootstrapping"
144 f_juju_get_pkg_info juju-pkg-info.txt
145
146
147=== modified file 'job-parts/build_osi.sh'
148--- job-parts/build_osi.sh 2016-08-30 01:52:10 +0000
149+++ job-parts/build_osi.sh 2017-03-01 03:45:48 +0000
150@@ -53,7 +53,7 @@
151 # Confirm deployment, configure it, run tests
152 f_line "Confirm deployment"
153 export JUJU_HOME=$OSI_JUJU_HOME
154-juju_ok="$(${OSCI_ROOT}/job-parts/juju_deploy_ok.sh ||:)"
155+juju_ok="$(${OSCI_ROOT}/job-parts/juju1_deploy_ok.sh ||:)"
156 echo $juju_ok
157 f_juju_status_health_check "-post-deploy"
158
159
160=== added file 'job-parts/deprecated/.keep'
161=== removed file 'job-parts/deprecated/Z_DEPRECATE_build_mojo_runner_baremetal.sh'
162--- job-parts/deprecated/Z_DEPRECATE_build_mojo_runner_baremetal.sh 2016-02-10 22:46:53 +0000
163+++ job-parts/deprecated/Z_DEPRECATE_build_mojo_runner_baremetal.sh 1970-01-01 00:00:00 +0000
164@@ -1,69 +0,0 @@
165-#!/bin/bash -e
166-# Mojo runner for OSCI
167-test="mojo-baremetal"
168-
169-# Define defaults for manual runs outside of a Jenkins environment
170-#[[ -z "$" ]] && export =""
171-[[ -z "$JENKINS_HOME" ]] && export JENKINS_HOME="$HOME"
172-[[ -z "$WORKSPACE" ]] && export WORKSPACE="$(mktemp -d)"
173-[[ -z "$BUILD_NUMBER" ]] && export BUILD_NUMBER="manual"
174-
175-[[ -z "$OSCI_REPO" ]] && export OSCI_REPO="lp:ubuntu-openstack-ci"
176-[[ -z "$OSCI_ROOT" ]] && export OSCI_ROOT="${HOME}/tools/ubuntu-openstack-ci"
177-
178-[[ -z "$OPENSTACK_CHARM_TESTING_REPO" ]] && export OPENSTACK_CHARM_TESTING_REPO="lp:openstack-charm-testing"
179-[[ -z "$OPENSTACK_CHARM_TESTING_ROOT" ]] && export OPENSTACK_CHARM_TESTING_ROOT="${HOME}/tools/openstack-charm-testing"
180-
181-[[ -z "$MOJO_OPENSTACK_SPECS_REPO" ]] && export MOJO_OPENSTACK_SPECS_REPO="lp:~ost-maintainers/openstack-mojo-specs/mojo-openstack-specs"
182-
183-[[ -z "$MOJO_SERIES" ]] && export MOJO_SERIES="trusty"
184-[[ -z "$MOJO_SPEC" ]] && export MOJO_SPEC="specs/full_stack/next_deploy_baremetal/icehouse"
185-
186-# Avoid environment teardown if run outside of a Jenkins environment
187-[[ -z "$BUILD_URL" ]] && export NO_POST_DESTROY="true"
188-
189-# Source the common functions
190-. ${OSCI_ROOT}/job-parts/osci_job_common.sh
191-
192-# Need to work in something like this
193-#export BAREMETAL=True
194-
195-# Set common, constant mojo workspace and project names
196-export MOJO_WORKSPACE_NAME="osci-mojo"
197-export MOJO_PROJ="mojo-openstack-specs"
198-export UOSCI_JUJU_TAGS="arch=amd64 tags=uosci"
199-
200-# Prep environment
201-f_fresh_clean_start
202-f_env_no_pass
203-f_mojo_install
204-
205-# Mojo Go!
206-f_line "validating mojo runner env vars"
207-f_mojo_handle_env_vars
208-
209-f_line "bootstrapping"
210-f_juju_get_pkg_info juju-pkg-info.txt
211-juju switch maas-${MOJO_SERIES}
212-juju bootstrap --upload-tools --constraints="${UOSCI_JUJU_TAGS}" 2>&1 | tee $WORKSPACE/juju-bootstrap.$BUILD_NUMBER
213-if [[ "${PIPESTATUS[0]}" != "0" ]]; then
214- echo " ! Bootstrap failed."
215- touch $WORKSPACE/fyi-${test:0:4}.${test}-bootstrap.failed
216-fi
217-
218-f_line "defining new mojo project"
219-f_mojo_new_project
220-
221-f_line "defining new mojo workspace"
222-f_mojo_perms_workaround
223-f_mojo_new_workspace
224-
225-f_line "run mojo, run!"
226-f_mojo_run
227-f_line "end of mojo's run"
228-
229-# Wrap up
230-f_collect_juju_logs
231-f_set_build_descr
232-f_nice_finish
233-f_check_fail
234
235=== removed file 'job-parts/deprecated/part_juju_cleanup.sh'
236--- job-parts/deprecated/part_juju_cleanup.sh 2016-08-30 02:59:59 +0000
237+++ job-parts/deprecated/part_juju_cleanup.sh 1970-01-01 00:00:00 +0000
238@@ -1,22 +0,0 @@
239-#!/bin/bash -e
240-echo $0
241-
242-# Source the common functions
243-#. ${OSCI_ROOT}/job-parts/osci_job_common.sh
244-
245-#echo "Making sure juju environment is clear for use on ${NODE_NAME}..."
246-#juju_ok="$(${OSCI_ROOT}/job-parts/juju_deploy_ok.sh || true)"
247-#echo $juju_ok
248-
249-#if [[ "$juju_ok" == *CLEAR:* ]]; then
250-# echo "Juju environment is clear on ${NODE_NAME}."
251-#else
252-# echo "An environment exists on ${NODE_NAME}!"
253-# echo "Attempting juju enviro destroy of ${JENV_NAME} on ${NODE_NAME}..."
254-# timeout 90 juju destroy-environment $env_name --force -y || true
255-# timeout 90 juju destroy-environment ${env_name}-jdev --force -y || true
256-# sleep 30
257-#fi
258-
259-echo " ! WARNING: deprecated, using the bigger hammer..."
260-${OSCI_ROOT}/job-parts/juju1_bighammer_destroy.sh
261
262=== modified file 'job-parts/juju1_bighammer_destroy.sh'
263--- job-parts/juju1_bighammer_destroy.sh 2016-12-03 16:14:58 +0000
264+++ job-parts/juju1_bighammer_destroy.sh 2017-03-01 03:45:48 +0000
265@@ -33,12 +33,18 @@
266 . ${OSCI_ROOT}/job-parts/osci_job_common.sh
267 f_novarc_undercloud
268
269+# Extra safety measure, as nova delete might be called.
270+if [[ $OS_USERNAME != osci ]] && [[ "${JENV_NAME^^}" != *MAAS* ]]; then
271+ echo " ! novarc env vars do not look like OSCI, halting here."
272+ exit 1
273+fi
274+
275 env_names="$(juju switch -l)"
276 j_env_dir="${HOME}/.juju/environments"
277 f_get_env_files
278
279 if [[ ! -d "$j_env_dir" ]]; then
280- echo " ! Never bootstrapped here before? Juju environment dir not found: ${j_env_dir}"
281+ echo " ! Juju environment dir not found: ${j_env_dir}"
282 fi
283
284 # Always attempt a destroy on all enviros/models if ANY are found
285@@ -69,40 +75,37 @@
286 # Delete nova instances if matches are found
287 f_get_env_files
288 f_get_my_nova_instances
289+
290 if [[ -n "$my_instances" ]]; then
291 echo " ! Nova instances unexpectedly remain after juju destroy. This is likely an undercloud issue."
292- echo "_:destroy.failed"
293
294-# XXX: nova instance cleanup is disabled, as it should not be necessary.
295-# If it becomes necessary, either the undercloud is failing to destroy
296-# instances, or the juju tooling has a bug.
297-#
298-# echo -e " - These nova instances will now be deleted:"
299+ echo -e " - These nova instances will be deleted:"
300 # Use filter on my_instances for added safety
301-# my_instances_filtered=$(echo "$my_instances" | grep "$nova_instance_safety_substring")
302-# echo "$my_instances_filtered"
303+ my_instances_filtered=$(echo "$my_instances" | egrep "$nova_instance_safety_substring")
304+ echo "$my_instances_filtered"
305
306-# while read -r line; do
307-# instance_id=$(echo $line | awk '{ print $2 }')
308-# echo " - Deleting nova instance: ${instance_id}"
309-# timeout 120 nova delete $instance_id
310-# done <<< "$my_instances_filtered"
311-# sleep 30
312+ while read -r line; do
313+ instance_id=$(echo $line | awk '{ print $2 }')
314+ echo " - Deleting nova instance: ${instance_id}"
315+ timeout 120 openstack server delete --wait $instance_id ||:
316+ done <<< "$my_instances_filtered"
317
318 # Re-check nova instances
319-# f_get_my_nova_instances
320-# if [[ -n "$my_instances" ]]; then
321-# echo "$my_instances"
322-# echo " ! Nova instance cleanup failed. One or more still exist. Manual intervention required."
323-# exit 1
324-# else
325-# echo " . Nova instances appear to be adequately cleaned up."
326-# fi
327+ f_get_my_nova_instances
328+ if [[ -n "$my_instances" ]]; then
329+ echo "$my_instances"
330+ echo " ! Nova instance cleanup failed. One or more still exist. Manual intervention required."
331+ echo "_:destroy.failed"
332+ # Never return if destroy failed; block to require human intervention.
333+ sleep infinity
334+ else
335+ echo " . Nova instances appear to be adequately cleaned up."
336+ fi
337 fi
338
339 # Delete juju .env files if they remain, after backing them up
340 if [[ -n "$env_files" ]]; then
341- echo " ! Juju environment file(s) remain after juju destroy:"
342+ echo " ! Juju1 env file(s) remain after juju destroy:"
343 echo "$env_files"
344 d_str=$(date +"%Y%m%d%H%M%S%N")
345 loc_dir="${HOME}/tmp.juju-env-files"
346@@ -124,7 +127,7 @@
347
348 for env_name in $env_names; do
349 export JENV_NAME="${env_name}"
350- juju_ok="$(timeout 30 ${OSCI_ROOT}/job-parts/juju_deploy_ok.sh || true)"
351+ juju_ok="$(timeout 30 ${OSCI_ROOT}/job-parts/juju1_deploy_ok.sh ||:)"
352
353 if [[ "$juju_ok" != *CLEAR:* ]]; then
354 echo " ! ${JENV_NAME} on ${NODE_NAME} is not clear."
355@@ -143,7 +146,9 @@
356 echo "$env_files"
357 echo " ! Instances:"
358 echo "$my_instances"
359- echo " ! Juju destroy failed. Manual intervention required."
360+ echo " ! juju1_bighammer_destroy failed. Manual intervention required."
361 echo "_:destroy.failed"
362- exit 1
363+
364+ # Never return if destroy failed; block to require human intervention.
365+ sleep infinity
366 fi
367
368=== renamed file 'job-parts/juju_deploy_ok.sh' => 'job-parts/juju1_deploy_ok.sh'
369--- job-parts/juju_deploy_ok.sh 2016-09-06 15:57:19 +0000
370+++ job-parts/juju1_deploy_ok.sh 2017-03-01 03:45:48 +0000
371@@ -2,11 +2,12 @@
372 # Check current juju environment for all good agent and instance states,
373 # or for an environment which is clean and ready to deploy to.
374 #
375-# Return 0 if enviro is clear to deploy to, or if deployment is nova/juju sane.
376+# Return 0 if enviro is clear to deploy to, or if deployment appears to be
377+# sane from a nova undercloud and juju perspective.
378
379-clear_tmps() {
380- rm -f $instances
381- rm -f $jstat
382+clear_tmp_files() {
383+ rm -f $instances_tmp_file
384+ rm -f $jstat_tmp_file
385 }
386
387 # Handle manual runs.
388@@ -26,34 +27,43 @@
389 echo "Juju env name: ${JENV_NAME}"
390
391 # Check for bad agent/machine states in juju status yaml output
392-jstat=$(mktemp)
393-juju stat --format=yaml &> $jstat || true
394-bad_states="$(cat $jstat | grep 'agent\-state:' | egrep -v 'started' || true)"
395+jstat_tmp_file=$(mktemp)
396+timeout 120 juju stat --format=yaml &> $jstat_tmp_file ||:
397+bad_states="$(cat $jstat_tmp_file | grep 'agent\-state:' | egrep -v 'started' ||:)"
398
399 # Check for juju environment files
400 echo "Checking for jenv files..."
401 if [[ -n "$OSI_JUJU_HOME" ]]; then
402 # openstack-installer is in play
403- jenv_files="$(ls ${HOME}/.juju/environments/*jenv ${OSI_JUJU_HOME}/environments/*jenv -alh 2> /dev/null || true)"
404+ jenv_files="$(ls ${HOME}/.juju/environments/*jenv ${OSI_JUJU_HOME}/environments/*jenv -alh 2> /dev/null ||:)"
405 else
406 # juju deployment (not openstack-installer)
407- jenv_files="$(ls ${HOME}/.juju/environments/*jenv -alh 2> /dev/null || true)"
408-fi
409-
410-# Check for good and bad nova instances where instance name
411-# contains the juju environment name.
412+ jenv_files="$(ls ${HOME}/.juju/environments/*jenv -alh 2> /dev/null ||:)"
413+fi
414+
415+# Check that juju status output looks like juju status output if env file exists
416+if ! grep "environment:" $jstat_tmp_file && [[ -n "$jenv_files" ]]; then
417+ msg="! MODEL-ERROR: Juju1 env file(s) exist but juju status not OK for ${JENV_NAME}."
418+ echo $bad_states
419+ clear_tmp_files
420+ echo "ERROR 6 - ${msg}"
421+ exit 6
422+fi
423+
424+# Check for good and bad nova instances where instance name contains the
425+# juju model/environment name.
426 if [[ "${JENV_NAME^^}" != *MAAS* ]]; then
427 echo "Checking for nova instances..."
428- instances=$(mktemp)
429- nova list | grep "\-${JENV_NAME}\-machine" > $instances || true
430- good_instances=$(grep 'ACTIVE' $instances || true)
431- bad_instances=$(grep -v 'ACTIVE' $instances || true)
432+ instances_tmp_file=$(mktemp)
433+ openstack server list | grep "\-${JENV_NAME}\-machine" > $instances_tmp_file ||:
434+ good_instances=$(grep 'ACTIVE' $instances_tmp_file ||:)
435+ bad_instances=$(grep -v 'ACTIVE' $instances_tmp_file ||:)
436
437 if [[ -n $good_instances ]]; then
438 if [[ -n $bad_instances ]]; then
439 echo "NON-ACTIVE: Nova list found non-ACTIVE instances for ${JENV_NAME}." \
440 "Perhaps a build is in progress or incomplete?"
441- clear_tmps
442+ clear_tmp_files
443 exit 1
444 fi
445 fi
446@@ -64,44 +74,44 @@
447 "active/STARTED, and Juju jenv file(s) exist for enviro: ${JENV_NAME}."
448 echo $bad_states
449 echo $jenv_files
450- cp $jstat $WORKSPACE/juju-stat-bad-states.$BUILD_NUMBER || true
451- clear_tmps
452+ cp $jstat_tmp_file $WORKSPACE/juju-stat-bad-states.$BUILD_NUMBER ||:
453+ clear_tmp_files
454 exit 2
455 elif [[ -n $bad_states ]] && [[ -z "$jenv_files" ]]; then
456 msg="! TEARDOWN-NEEDED: Juju environment, agent and/or instance states are bad, and Juju jenv file(s) do not exist for ${JENV_NAME}."
457 echo $bad_states
458- clear_tmps
459- while true; do echo "ERROR 3 - Manual intervention required. Undercloud issue? ${msg}"; sleep 120; done
460-# exit 3
461+ clear_tmp_files
462+ echo "ERROR 3 - Manual intervention required. Undercloud issue? ${msg}"
463+ exit 3
464 elif [[ -z $bad_states ]] && [[ -n "$jenv_files" ]] && [[ -z $bad_instances ]] && [[ -n $good_instances ]]; then
465 echo " . DEPLOYED: Juju environment, agent and instance states are good," \
466 "and Juju jenv file(s) exist for ${JENV_NAME}."
467- clear_tmps
468+ clear_tmp_files
469 exit 0
470 elif [[ -z $bad_states ]] && [[ -n "$jenv_files" ]] && [[ "${JENV_NAME^^}" == *MAAS* ]]; then
471- echo " . DEPLOYED: Juju environment (maas substrate), agent states are good," \
472+ echo " . DEPLOYED: Juju environment (maas provider), agent states are good," \
473 "and Juju jenv file(s) exist for ${JENV_NAME}."
474- clear_tmps
475+ clear_tmp_files
476 exit 0
477 elif [[ -z $bad_states ]] && [[ -z "$jenv_files" ]] && [[ -z $bad_instances ]] && [[ -z $good_instances ]]; then
478 echo " . CLEAR: Juju environment, agent and instance states not found," \
479 "and Juju jenv file(s) do not exist for ${JENV_NAME}."
480- clear_tmps
481+ clear_tmp_files
482 exit 0
483 elif [[ -z $good_instances ]] && [[ -z $bad_instances ]] && [[ -n "$jenv_files" ]] && [[ "${JENV_NAME^^}" != *MAAS* ]]; then
484- msg=" ! TEARDOWN-NEEDED: Funky state! Juju jenv file(s) exist, but there are no nova instances for: ${JENV_NAME}."
485+ msg=" ! TEARDOWN-NEEDED: Juju jenv file(s) exist, but there are no nova instances for: ${JENV_NAME}."
486 echo "jenv_files: ${jenv_files}"
487- clear_tmps
488- while true; do echo "ERROR 4 - Manual intervention required. Undercloud issue? ${msg}"; sleep 120; done
489-# exit 4
490+ clear_tmp_files
491+ echo "ERROR 4 - Manual intervention required. Undercloud issue? ${msg}"
492+ exit 4
493 else
494- msg=" ! FAIL: Unknown state, need to debug or troubleshoot this node. Env name: ${JENV_NAME}. Possibly a non-default juju environment deployed?"
495+ msg=" ! FAIL: Unknown state, need to debug or troubleshoot this node. Env name: ${JENV_NAME}."
496 echo "1: ${JENV_NAME}"
497 echo "2: ${bad_instances}"
498 echo "3: ${good_instances}"
499 echo "4: ${bad_states}"
500 echo "5: ${jenv_files}"
501- clear_tmps
502- while true; do echo "ERROR 5 - Manual intervention required. Undercloud issue? ${msg}"; sleep 120; done
503-# exit 5
504+ clear_tmp_files
505+ echo "ERROR 5 - Manual intervention required. Undercloud issue? ${msg}"
506+ exit 5
507 fi
508
509=== modified file 'job-parts/osci_job_common.sh'
510--- job-parts/osci_job_common.sh 2016-11-22 19:38:19 +0000
511+++ job-parts/osci_job_common.sh 2017-03-01 03:45:48 +0000
512@@ -112,7 +112,13 @@
513 [[ -n "$1" ]] && PARAM1="$1" || PARAM1=""
514 f_line "Checking juju stat health: $PARAM1"
515
516- ${OSCI_ROOT}/tools/juju_status_health_check.py --Xb 2>&1 | tee $WORKSPACE/juju-stat-health-check${PARAM1}.txt; ret_code=${PIPESTATUS[0]}
517+ # Run jshc from a venv as a work-around to:
518+ # https://bugs.launchpad.net/ubuntu/+source/paramiko/+bug/1665565
519+ # https://bugs.launchpad.net/charm-test-infra/+bug/1665598
520+ # ${OSCI_ROOT}/tools/juju_status_health_check.py --Xb 2>&1 | tee $WORKSPACE/juju-stat-health-check${PARAM1}.txt; ret_code=${PIPESTATUS[0]}
521+ cd ${OSCI_ROOT}/tools
522+ deactivate ||:
523+ tox -re jshc | tee $WORKSPACE/juju-stat-health-check${PARAM1}.txt; ret_code=${PIPESTATUS[0]}
524 echo "Returned: ${ret_code}"
525 case "$ret_code" in
526 0)
527@@ -185,7 +191,7 @@
528
529 if [[ "${SKIP_JUJU_LXC^^}" != "TRUE" ]]; then
530 ${OSCI_ROOT}/job-parts/juju1_bighammer_destroy.sh YES
531-# f_delete_neutron_ext_net_ports ||:
532+ f_delete_neutron_ext_net_ports
533 f_mojo_broom
534 f_osi_broom
535 f_juju_get_pkg_info tools-pkg-info.txt
536@@ -232,20 +238,29 @@
537 }
538
539
540-# Deprecated - neutron port-list no longer contains a juju human name to grep.
541-#function f_delete_neutron_ext_net_ports() {
542+function f_delete_neutron_ext_net_ports() {
543 # CLEANUP: delete neutron ext-net ports, commonly added by mojo or other
544 # post-deployment configuration for the network node's 2nd nic.
545-# f_novarc_undercloud
546-# if [[ -z "${JENV_NAME}" ]]; then
547-# echo " ! Missing required env var JENV_NAME"
548-# exit 1
549-# fi
550-# if [[ "${JENV_NAME^^}" != *MAAS* ]]; then
551-# f_line "Deleting undercloud tenant's neutron ext-net ports if they exist"
552-# for i in $(neutron port-list | grep juju-$JENV_NAME | grep ext-port | awk '{ print $2 }'); do echo $i; neutron port-delete $i; done
553-# fi
554-#}
555+ f_novarc_undercloud
556+ if [[ -z "${JENV_NAME}" ]]; then
557+ echo " ! Missing required env var JENV_NAME"
558+ exit 1
559+ fi
560+ if [[ ! -f "${UOSCI_BOT_CONTROL_ROOT}/tools/juju-sym-switch" ]]; then
561+ f_tool_refresh_bot_control
562+ fi
563+ if [[ "${JENV_NAME^^}" != *MAAS* ]]; then
564+ f_line "Deleting undercloud tenant's neutron ext-net ports if they exist"
565+ pwd
566+ cd ${UOSCI_BOT_CONTROL_ROOT}/tools
567+ deactivate ||:
568+ tox -re port-cleanup
569+ . .tox/port-cleanup/bin/activate
570+ ${UOSCI_BOT_CONTROL_ROOT}/tools/port-cleanup -pn "juju-${JENV_NAME}.*-machine.*ext-port" -ps "DOWN" --delete
571+ cd $WORKSPACE
572+ pwd
573+ fi
574+}
575
576
577 function f_delete_secgroups() {
578@@ -275,7 +290,7 @@
579 if [[ "${NO_POST_DESTROY^^}" != "TRUE" ]] && [[ "${SKIP_JUJU_LXC^^}" != "TRUE" ]]; then
580 f_line "Destroy"
581 ${OSCI_ROOT}/job-parts/juju1_bighammer_destroy.sh YES
582-# f_delete_neutron_ext_net_ports ||:
583+ f_delete_neutron_ext_net_ports
584
585 f_line "Post-Destroy Info Dump"
586 export SUBNET_ID=$(neutron net-show $(cat $JENKINS_HOME/.juju/environments.yaml | grep network: | head -n1 | awk '{ print $2 }') | grep subnets | awk '{ print $4 }')
587@@ -690,7 +705,9 @@
588
589 function f_get_my_nova_instances() {
590 # Get nova instances for the current juju environment
591- export my_instances=$(timeout 30 nova list | grep "juju\-${JENV_NAME}\-machine" ||:)
592+ if [[ "${JENV_NAME^^}" != *MAAS* ]]; then
593+ export my_instances=$(timeout 60 nova list | grep "juju\-${JENV_NAME}\-machine" ||:)
594+ fi
595 }
596
597
598
599=== modified file 'job-parts/osci_mojo_common.sh'
600--- job-parts/osci_mojo_common.sh 2016-12-09 18:22:55 +0000
601+++ job-parts/osci_mojo_common.sh 2017-03-01 03:45:48 +0000
602@@ -4,12 +4,23 @@
603
604 function f_mojo_broom() {
605 if [[ -d "/srv/mojo/mojo-openstack-specs/" ]]; then
606- echo " - Purging /srv/mojo/mojo-openstack-specs ..."
607- rm -rfv /srv/mojo/mojo-openstack-specs/*
608+ echo " - Purging /srv/mojo/mojo-openstack-specs"
609+ rm -rf /srv/mojo/mojo-openstack-specs/*
610+ echo " - Purging $MOJO_ROOT"
611+ rm -rf ${MOJO_ROOT}
612 fi
613 }
614
615
616+function f_mojo_create_venv() {
617+ cd $UOSCI_BOT_CONTROL_ROOT/tools/mojo-openstack
618+ deactivate ||:
619+ tox
620+ . .tox/mojo/bin/activate
621+ cd $WORKSPACE
622+}
623+
624+
625 function f_mojo_new_project() {
626 # Add mojo project.
627 if [[ -n "$(ls $WORKSPACE -1 | egrep '.failed|.bad')" ]]; then
628@@ -17,8 +28,8 @@
629 touch $WORKSPACE/fyi-${test:0:4}.mojo-project-new.skipped
630 else
631 set -x
632- mojo project-new --series ${MOJO_SERIES} \
633- --container containerless ${MOJO_PROJ} 2>&1 | tee $WORKSPACE/mojo-project-new.txt
634+ mojo-project-new --series ${MOJO_SERIES} \
635+ --container containerless ${MOJO_PROJ} --mojo-root ${MOJO_ROOT} 2>&1 | tee $WORKSPACE/mojo-project-new.txt
636 # Error trap
637 if [[ "${PIPESTATUS[0]}" != "0" ]]; then
638 echo " ! Failed to create new mojo project."
639@@ -30,16 +41,6 @@
640 }
641
642
643-# No longer necessary, as we run mojo "containerless"
644-#function f_mojo_lxc_perms_workaround() {
645-# Workaround for bug https://bugs.launchpad.net/mojo/+bug/1346873
646-# set -x
647-# sudo chmod 755 /var/lib/lxc/${MOJO_PROJ}.${MOJO_SERIES} || true
648-# sudo chmod 755 /var/lib/lxc || true
649-# set +x
650-#}
651-
652-
653 function f_mojo_new_workspace() {
654 # Add mojo workspace.
655 if [[ -n "$(ls $WORKSPACE -1 | egrep '.failed|.bad')" ]]; then
656@@ -47,9 +48,10 @@
657 touch $WORKSPACE/fyi-${test:0:4}.mojo-workspace-new.skipped
658 else
659 set -x
660- mojo workspace-new --project ${MOJO_PROJ} --series ${MOJO_SERIES} \
661- --stage ${MOJO_SPEC} ${MOJO_OPENSTACK_SPECS_REPO} ${MOJO_WORKSPACE_NAME} \
662+ mojo --mojo-root ${MOJO_ROOT} workspace-new --project ${MOJO_PROJ} --series ${MOJO_SERIES} \
663+ --stage ${MOJO_SPEC} ${MOJO_OPENSTACK_SPECS_REPO} ${MOJO_WKSP} \
664 2>&1 | tee $WORKSPACE/mojo-workspace-new.txt
665+
666 # Error trap
667 if [[ "${PIPESTATUS[0]}" != "0" ]]; then
668 echo " ! Failed to create new mojo workspace."
669@@ -71,9 +73,10 @@
670 f_openstack_set_network_env_vars
671 #f_amulet_set_network_env_vars
672 set -x
673- mojo run --project ${MOJO_PROJ} --series ${MOJO_SERIES} \
674- --stage ${MOJO_SPEC} ${MOJO_OPENSTACK_SPECS_REPO} ${MOJO_WORKSPACE_NAME} \
675+ mojo --mojo-root ${MOJO_ROOT} run --project ${MOJO_PROJ} --series ${MOJO_SERIES} \
676+ --stage ${MOJO_SPEC} ${MOJO_OPENSTACK_SPECS_REPO} ${MOJO_WKSP} \
677 2>&1 | tee $WORKSPACE/mojo-run.txt
678+
679 # Error trap
680 if [[ "${PIPESTATUS[0]}" != "0" ]]; then
681 echo " ! Mojo run manifest failed."
682@@ -84,23 +87,6 @@
683 }
684
685
686-# DEPRECATED
687-#function f_lxc_destroy_all() {
688-# Destroy all lxc containser if any exist
689-# lxc_ls="$(sudo lxc-ls -1)"
690-# if [[ -z "$lxc_ls" ]]; then
691-# echo "OK: no lxc containers to destroy."
692-# else
693-# echo " - Destroying all lxc containers:"
694-# for container in "$(sudo lxc-ls -1)"; do
695-# echo " - ${container}"
696-# sudo lxc-destroy --name ${container} --force || true
697-# sudo lxc-destroy --name ${container} --force || true
698-# done
699-# fi
700-#}
701-
702-
703 function f_mojo_handle_env_vars() {
704 # Validate and process mojo runner environment variables.
705
706
707=== modified file 'job-parts/trigger_by_mojo_group.sh'
708--- job-parts/trigger_by_mojo_group.sh 2016-09-27 05:03:27 +0000
709+++ job-parts/trigger_by_mojo_group.sh 2017-03-01 03:45:48 +0000
710@@ -76,6 +76,9 @@
711 NEWTON_ALL)
712 tools/trigger_mojo_group.py -o newton
713 ;;
714+ OCATA_ALL)
715+ tools/trigger_mojo_group.py -o ocata
716+ ;;
717
718 PRECISE_ALL)
719 tools/trigger_mojo_group.py -u precise
720@@ -89,6 +92,9 @@
721 YAKKETY_ALL)
722 tools/trigger_mojo_group.py -u yakkety
723 ;;
724+ ZESTY_ALL)
725+ tools/trigger_mojo_group.py -u zesty
726+ ;;
727
728 CHARM_UPGRADE)
729 tools/trigger_mojo_group.py -s stable_to_next
730
731=== modified file 'populate/mappings.yaml'
732--- populate/mappings.yaml 2016-12-09 20:05:45 +0000
733+++ populate/mappings.yaml 2017-03-01 03:45:48 +0000
734@@ -32,8 +32,11 @@
735 xenial:
736 - mitaka
737 - newton
738+ - ocata
739 yakkety:
740 - newton
741+ zesty:
742+ - ocata
743
744 # the things we care most about right now
745 hot:
746@@ -48,8 +51,11 @@
747 xenial:
748 - mitaka
749 - newton
750+ - ocata
751 yakkety:
752 - newton
753+ zesty:
754+ - ocata
755
756 # openstack installation sources
757 inst-sources:
758@@ -144,11 +150,8 @@
759 http://docs.openstack.org/infra/manual/developers.html
760 trigger-deployments:
761 default.yaml:
762- - trusty-icehouse
763- - trusty-kilo
764- - trusty-liberty
765-# - trusty-mitaka
766-# - xenial-mitaka
767+ - trusty-mitaka
768+ - xenial-mitaka
769 next.yaml:
770 - trusty-icehouse
771 - trusty-kilo
772@@ -156,14 +159,13 @@
773 - trusty-mitaka
774 - xenial-mitaka
775 - xenial-newton
776+ - xenial-ocata
777
778 # deployment set to trigger based on merge proposals
779 # the merge-proposed branch will be substituted for the target branch
780 mp-trigger-deployments:
781 next.yaml:
782 - trusty-icehouse
783- - trusty-kilo
784- - trusty-liberty
785 - trusty-mitaka
786 - xenial-mitaka
787 - xenial-newton
788
789=== modified file 'tools/juju_status_health_check.py'
790--- tools/juju_status_health_check.py 2016-06-03 17:20:08 +0000
791+++ tools/juju_status_health_check.py 2017-03-01 03:45:48 +0000
792@@ -1,4 +1,4 @@
793-#!/usr/bin/python
794+#!/usr/bin/env python
795 '''
796 juju status health check (not to be confused with juju health status)
797
798
799=== added file 'tools/requirements.txt'
800--- tools/requirements.txt 1970-01-01 00:00:00 +0000
801+++ tools/requirements.txt 2017-03-01 03:45:48 +0000
802@@ -0,0 +1,10 @@
803+# Work-arounds for:
804+# https://bugs.launchpad.net/ubuntu/+source/paramiko/+bug/1665565
805+# https://bugs.launchpad.net/charm-test-infra/+bug/1665598
806+paramiko==2.1.1
807+crypto==1.4.1
808+distro-info
809+launchpadlib==1.10.5
810+bzr==2.7.0
811+jinja2==2.9.5
812+simplejson==3.10.0
813
814=== added file 'tools/tox.ini'
815--- tools/tox.ini 1970-01-01 00:00:00 +0000
816+++ tools/tox.ini 2017-03-01 03:45:48 +0000
817@@ -0,0 +1,19 @@
818+[tox]
819+envlist = noop
820+skipsdist = True
821+
822+[testenv]
823+setenv = VIRTUAL_ENV={envdir}
824+ PYTHONHASHSEED=0
825+passenv = HOME TERM
826+install_command =
827+ pip install --allow-unverified python-apt {opts} {packages}
828+
829+[testenv:noop]
830+basepython = python2.7
831+
832+[testenv:jshc]
833+basepython = python2.7
834+deps = -r{toxinidir}/requirements.txt
835+whitelist_externals = juju_status_health_check.py
836+commands = ./juju_status_health_check.py

Subscribers

People subscribed via source and target branches