grub> ls (hd0,gpt2)
(hd0,gpt2): Filesystem is unknown.
grub> ls (hd0,gpt3)
(hd0,gpt3): Filesystem is xfs.
grub> ls (hd0,gpt1)
(hd0,gpt1): Filesystem is fat.
grub>
ol-consolebaud.service: main process exited, code=exited, status=1/FAILURE
Failed to start Check console baud rate.
Unit ol-consolebaud.service entered failed state.
ol-consolebaud.service failed.
$ sudo dnf update oci-utils -y
Last metadata expiration check: 4:26:16 ago on Tue 08 Jun 2021 01:30:06 PM JST.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Upgrading:
oci-utils noarch 0.12.4-1.el8 ol8_oci_included 245 k
Installing dependencies:
python3-arrow noarch 0.17.0-1.0.1.el8 ol8_oci_included 101 k
python3-click noarch 6.7-8.el8 ol8_appstream 131 k
python3-convertdate noarch 2.3.0-1.0.1.el8 ol8_oci_included 83 k
python3-dateparser noarch 1.0.0-1.0.1.el8 ol8_oci_included 392 k
python3-hijri-converter noarch 2.1.1-1.0.1.el8 ol8_oci_included 30 k
python3-jmespath noarch 0.10.0-1.el8 ol8_oci_included 48 k
python3-pymeeus noarch 0.3.6-2.0.1.el8 ol8_oci_included 1.1 M
python3-regex aarch64 2021.4.4-1.el8 ol8_developer_EPEL 328 k
python3-retrying noarch 1.3.3-1.0.1.el8 ol8_oci_included 22 k
python3-terminaltables noarch 3.1.0-1.0.1.el8 ol8_oci_included 31 k
python3-tzlocal noarch 2.0.0-4.el8 ol8_oci_included 37 k
python36-oci-cli noarch 2.22.1-1.el8 ol8_oci_included 6.4 M
Transaction Summary
================================================================================
Install 12 Packages
Upgrade 1 Package
Total download size: 8.9 M
<略>
$
$ oci ons message publish --topic-id ocid1.onstopic.oc1.ap-tokyo-1.<略> --title "test mail" --body "test mail"
ERROR: Could not find config file at /home/opc/.oci/config, please follow the instructions in the link to setup the config file https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm
$
$ oci setup keys
Enter a passphrase for your private key (empty for no passphrase):
Public key written to: /home/opc/.oci/oci_api_key_public.pem
Private key written to: /home/opc/.oci/oci_api_key.pem
Public key fingerprint: xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
If you haven't already uploaded your API Signing public key through the
console, follow the instructions on the page linked below in the section
'How to upload the public key':
https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#How2
$ ls -al ~/.oci
total 8
drwx------. 2 opc opc 59 Jun 7 17:32 .
drwx------. 5 opc opc 138 Jun 7 17:32 ..
-rw-------. 1 opc opc 1679 Jun 7 17:32 oci_api_key.pem
-rw-------. 1 opc opc 451 Jun 7 17:32 oci_api_key_public.pem
$
$ oci ons message publish --topic-id ocid1.onstopic.oc1.ap-tokyo-1.aa<略> --title "test mail" --body "test mail"
WARNING: Permissions on /home/opc/.oci/config are too open.
To fix this please try executing the following command:
oci setup repair-file-permissions --file /home/opc/.oci/config
Alternatively to hide this warning, you may set the environment variable, OCI_CLI_SUPPRESS_FILE_PERMISSIONS_WARNING:
export OCI_CLI_SUPPRESS_FILE_PERMISSIONS_WARNING=True
{
"data": {
"message-id": "56ca7636-1605-7a19-5344-<略>",
"time-stamp": null
}
}
$
まず、「WARNING: Permissions on /home/opc/.oci/config are too open.」についてはパーミッション問題なので、書いてある通りに対処する。
$ ls -l /home/opc/.oci/config
-rw-rw-rw-. 1 opc opc 299 Jun 7 17:43 /home/opc/.oci/config
$ oci setup repair-file-permissions --file /home/opc/.oci/config
$ ls -l /home/opc/.oci/config
-rw-------. 1 opc opc 299 Jun 7 17:43 /home/opc/.oci/config
$
$ sudo vi /usr/local/bin/oci-notification-mail
$ cat /usr/local/bin/oci-notification-mail
#!/usr/bin/python3
# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
import oci
import sys
argvs=sys.argv
argc = len(argvs)
subject=argvs[1]
textbody="".join(sys.stdin.readlines())
# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()
# Initialize service client with default config file
ons_client = oci.ons.NotificationDataPlaneClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
publish_message_response = ons_client.publish_message(
topic_id="ocid1.onstopic.oc1.ap-tokyo-1.<略>",
message_details=oci.ons.models.MessageDetails(
body=textbody,
title=subject),
message_type="RAW_TEXT")
# Get the data from response
print(publish_message_response.data)
$ sudo chmod a+x /usr/local/bin/oci-notification-mail
$