我的Oracle Developer生成失败,并声明了有关未经授权的HTTP代码的一些内容:

 oracle-oci: Problem creating instance: Service error:NotAuthenticated. The required information to complete authentication was not provided or was incorrect.. http status code: 401

我的packer json构建有一堆我刚刚设置的元素,其中一堆在字符串中有OCI。。。
  "builders": [
    {
      "user_ocid":"ocid1.user.oc1..",
      "tenancy_ocid": "ocid1.tenancy.oc1..",
      "fingerprint":"0d:1e:...",
      "key_file":"oci_api_key.pem",
      "availability_domain": "uKbv:CA-TORONTO-1-AD-1",
      "region": "us-ashburn-1",
      "base_image_ocid": "ocid1.image.oc1.iad...",
      "compartment_ocid": "ocid1.compartment.oc1..",
      "image_name": "DevCS_MYSQL",
      "shape": "VM.Standard2.2",
      "ssh_username": "opc",
      "ssh_password": "welcome1",
      "subnet_ocid": "ocid1.subnet.oc1.ca-johnstown-1...",
      "type": "oracle-oci"
    }
  ],

如何判断哪一个是错误的并导致HTTP 401未经授权的代码我没有看到任何提到的元素,也没有看到
[2019-08-21 12:44:50] Build scheduled. Build started by user [email protected]
[2019-08-21 12:44:50] Build task id: 830601c8-5ba8-4dc4-8bdc-07abaff9de73
[2019-08-21 12:55:03] Build execution started.
[2019-08-21 12:55:03] Building on slave PackerTerraformNodeJS
[2019-08-21 12:55:02] Git: Checkout directory is the workspace root.
[2019-08-21 12:55:02] Git: git version 1.8.3.1
[2019-08-21 12:55:02] Git: Fetching from remote repository https://mysqlalphaoffice-helpdeskaleer.developer.ocp.oraclecloud.com/mysqlalphaoffice-helpdeskaleer/s/mysqlalphaoffice-helpdeskaleer_mysql-alphaoffice_10254/scm/MYSQL-PackerTerraform.git
[2019-08-21 12:55:02] /bin/git fetch --no-tags https://mysqlalphaoffice-helpdeskaleer.developer.ocp.oraclecloud.com/mysqlalphaoffice-helpdeskaleer/s/mysqlalphaoffice-helpdeskaleer_mysql-alphaoffice_10254/scm/MYSQL-PackerTerraform.git +refs/heads/*:refs/remotes/origin/*
[2019-08-21 12:55:04] Git: Checking out branch master
[2019-08-21 12:55:04] Git: Done
[2019-08-21 12:55:04] BEGIN shell script execution with /bin/sh -ex
[2019-08-21 12:55:04] + packer --version
[2019-08-21 12:55:04] 1.3.5
[2019-08-21 12:55:04] + tee output.txt
[2019-08-21 12:55:04] + packer build build.json
[2019-08-21 12:55:05] [1;32moracle-oci output will be in this color.[0m
[2019-08-21 12:55:05] [1;32m==> oracle-oci: Creating temporary ssh key for instance...[0m
[2019-08-21 12:55:05] [1;32m==> oracle-oci: Creating instance...[0m
[2019-08-21 12:55:05] [1;31m==> oracle-oci: Problem creating instance: Service error:NotAuthenticated. The required information to complete authentication was not provided or was incorrect.. http status code: 401[0m
[2019-08-21 12:55:05] [1;31mBuild 'oracle-oci' errored: Problem creating instance: Service error:NotAuthenticated. The required information to complete authentication was not provided or was incorrect.. http status code: 401[0m
[2019-08-21 12:55:05] ==> Some builds didn't complete successfully and had errors:
[2019-08-21 12:55:05] --> oracle-oci: Problem creating instance: Service error:NotAuthenticated. The required information to complete authentication was not provided or was incorrect.. http status code: 401
[2019-08-21 12:55:05] ==> Builds finished but no artifacts were created.
[2019-08-21 12:55:05] + ls -l
[2019-08-21 12:55:05] total 56
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder 2577 Aug 21 12:55 build.json
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder 1406 Aug 21 12:55 compute.tf
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder  888 Aug 21 12:55 datasources.tf
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder   99 Aug 21 12:55 Dockerfile
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder  786 Aug 21 12:55 env-vars
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder 2983 Aug 21 12:55 network.tf
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder 1675 Aug 21 12:55 oci_api_key.pem
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder  450 Aug 21 12:55 oci_api_key_public.pem
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder 1678 Aug 21 12:55 oci_instance_key
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder  402 Aug 21 12:55 oci_instance_key.pub
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder  488 Aug 21 12:55 outputs.tf
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder  874 Aug 21 12:55 output.txt
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder  260 Aug 21 12:55 provider.tf
[2019-08-21 12:55:05] -rw-r-----. 1 builder builder 1726 Aug 21 12:55 variables.tf
[2019-08-21 12:55:05] + cat output.txt
[2019-08-21 12:55:05] [1;32moracle-oci output will be in this color.[0m
[2019-08-21 12:55:05] [1;32m==> oracle-oci: Creating temporary ssh key for instance...[0m
[2019-08-21 12:55:05] [1;32m==> oracle-oci: Creating instance...[0m
[2019-08-21 12:55:05] [1;31m==> oracle-oci: Problem creating instance: Service error:NotAuthenticated. The required information to complete authentication was not provided or was incorrect.. http status code: 401[0m
[2019-08-21 12:55:05] [1;31mBuild 'oracle-oci' errored: Problem creating instance: Service error:NotAuthenticated. The required information to complete authentication was not provided or was incorrect.. http status code: 401[0m
[2019-08-21 12:55:05] ==> Some builds didn't complete successfully and had errors:
[2019-08-21 12:55:05] --> oracle-oci: Problem creating instance: Service error:NotAuthenticated. The required information to complete authentication was not provided or was incorrect.. http status code: 401
[2019-08-21 12:55:05] ==> Builds finished but no artifacts were created.
[2019-08-21 12:55:05] /data/cibuild/830601c8-5ba8-4dc4-8bdc-07abaff9de73/tmp/script5780075887420937130.sh: line 5: unexpected EOF while looking for matching ``'
[2019-08-21 12:55:05] Error: Command exited with status 2
[2019-08-21 12:55:05] END shell script execution
[2019-08-21 12:55:05] No artifacts requested
Slave log size 4.6 KB (4,622)
[2019-08-21 12:55:07]
[2019-08-21 12:55:07] Build completed.
[2019-08-21 12:55:07] Status: DONE Result: FAILED Duration: 5.0 sec

最佳答案

401 NotAuthenticated表示其中一个值有问题:

"user_ocid":"ocid1.user.oc1..",
"tenancy_ocid": "ocid1.tenancy.oc1..",
"fingerprint":"0d:1e:...",
"key_file":"oci_api_key.pem",

这些设置都用于构造用于向OCI进行身份验证的签名字符串。当验证失败时,您将得到401未验证的响应。

关于linux - 使用HTTP 401的开发人员云服务和Packer构建失败未经授权?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57593113/

10-12 14:28