Skip to content

Commit 30729f0

Browse files
authored
Merge pull request apache#282 from theopenlab/fix-bugs
Fix packer jobs error caused by image and sg id
2 parents 95a405e + 0fa6aba commit 30729f0

File tree

1 file changed

+5
-3
lines changed
  • playbooks/packer-functional-devstack

1 file changed

+5
-3
lines changed

playbooks/packer-functional-devstack/run.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
EOF
1717
image_name="packer-cirros-$(date +%s)"
1818
network=$(openstack network show private -f value -c id)
19-
src_img_name=$(openstack image list |grep -Eo "cirros-.*")
19+
src_img_name=$(openstack image list -f value -c Name | grep -Eo "cirros-.*" | grep -v ramdisk | grep -v kernel)
2020
cat << EOF >> os-template.json
2121
{
2222
"builders": [
@@ -46,8 +46,10 @@
4646
]
4747
}
4848
EOF
49-
sg_id=$(openstack security group list --project $OS_PROJECT_NAME -f value -c ID -c Name |grep default \
50-
|head -n 1 |awk '{print $1}')
49+
# NOTE: "--project" option is not supported for "openstack security group list" command
50+
# in M and N release, so we have to filter "default" sg of current project by project id.
51+
project_id=$(openstack token issue -f value -c project_id)
52+
sg_id=$(openstack security group list | grep default | grep $project_id | head -n 1 | awk '{print $2}')
5153
openstack security group rule create --ingress --protocol tcp --dst-port 22 $sg_id
5254
packer validate os-template.json
5355
packer build -color=false os-template.json

0 commit comments

Comments
 (0)