Skip to content

Commit

Permalink
upgrade ubuntu version to 22.04
Browse files Browse the repository at this point in the history
  • Loading branch information
akshata-s-banoshi committed Aug 10, 2023
1 parent 869a644 commit 1f03376
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
jobs:
build:
name: Build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Compilation
Expand Down
13 changes: 10 additions & 3 deletions caputilities/enigma.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

//Package caputilities ...
// Package caputilities ...
package caputilities

import (
Expand Down Expand Up @@ -104,6 +104,7 @@ func bytesToPublicKey(publicKey []byte) *rsa.PublicKey {
}

func bytesToPrivateKey(privateKey []byte) *rsa.PrivateKey {
var key *rsa.PrivateKey
block, _ := pem.Decode(privateKey)
enc := x509.IsEncryptedPEMBlock(block)
b := block.Bytes
Expand All @@ -115,9 +116,15 @@ func bytesToPrivateKey(privateKey []byte) *rsa.PrivateKey {
logging.Error(err)
}
}
key, err := x509.ParsePKCS1PrivateKey(b)
pkcs1Key, err := x509.ParsePKCS1PrivateKey(b)
if err != nil {
logging.Fatal(err)
pkcs8Key, err := x509.ParsePKCS8PrivateKey(b)
if err != nil {
logging.Fatal(err)
}
key = pkcs8Key.(*rsa.PrivateKey)
} else {
key = pkcs1Key
}
return key
}
33 changes: 20 additions & 13 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//License for the specific language governing permissions and limitations
// under the License.

//Package config ...
// Package config ...
package config

import (
Expand Down Expand Up @@ -65,7 +65,7 @@ type DBConf struct {
RedisOnDiskPassword []byte
}

//PluginConf is for holding all the plugin related configurations
// PluginConf is for holding all the plugin related configurations
type PluginConf struct {
ID string `json:"ID"` // PluginID hold the id of the plugin
Host string `json:"Host"`
Expand All @@ -74,13 +74,13 @@ type PluginConf struct {
Password string `json:"Password"`
}

//LoadBalancerConf is for holding all load balancer related configurations
// LoadBalancerConf is for holding all load balancer related configurations
type LoadBalancerConf struct {
Host string `json:"LBHost"`
Port string `json:"LBPort"`
}

//EventConf is for holding all events related configuration
// EventConf is for holding all events related configuration
type EventConf struct {
DestURI string `json:"DestinationURI"`
ListenerHost string `json:"ListenerHost"`
Expand All @@ -94,7 +94,7 @@ type MessageBusConf struct {
EmbQueue []string `json:"MessageBusQueue"`
}

//KeyCertConf is for holding all security oriented configuration
// KeyCertConf is for holding all security oriented configuration
type KeyCertConf struct {
RootCACertificatePath string `json:"RootCACertificatePath"` // RootCACertificate will be added to truststore
PrivateKeyPath string `json:"PrivateKeyPath"` // plugin private key
Expand All @@ -120,7 +120,7 @@ type TLSConf struct {
PreferredCipherSuites []string `json:"PreferredCipherSuites"`
}

//APICConf is for holding all the cisco APIC related configurations
// APICConf is for holding all the cisco APIC related configurations
type APICConf struct {
APICHost string `json:"APICHost"`
UserName string `json:"UserName"`
Expand Down Expand Up @@ -237,7 +237,7 @@ func checkODIMConf() error {
return nil
}

//check load balancer configuration
// check load balancer configuration
func checkLBConf() {
if Data.LoadBalancerConf == nil {
log.Info("no value set for LoadBalancerConf, setting default value")
Expand Down Expand Up @@ -270,7 +270,7 @@ func checkEventConf() error {
return nil
}

//Check or apply default values for message bus to be used by this plugin
// Check or apply default values for message bus to be used by this plugin
func checkMessageBusConf() error {
if Data.MessageBusConf == nil {
return fmt.Errorf("no value found for MessageBusConf")
Expand All @@ -293,7 +293,7 @@ func checkMessageBusConf() error {
return nil
}

//Check or apply default values for certs/keys used by this plugin
// Check or apply default values for certs/keys used by this plugin
func checkCertsAndKeysConf() error {
var err error
if Data.KeyCertConf == nil {
Expand All @@ -316,7 +316,7 @@ func checkCertsAndKeysConf() error {
return nil
}

//Check or apply default values for URL translation from ODIM <=> redfish
// Check or apply default values for URL translation from ODIM <=> redfish
func checkURLTranslationConf() {
if Data.URLTranslation == nil {
log.Info("URL translation not provided, setting default value")
Expand Down Expand Up @@ -451,6 +451,7 @@ func decryptRSAOAEPEncryptedPasswords(encryptedPassword string) ([]byte, error)
}

func bytesToPrivateKey(privateKey []byte) (*rsa.PrivateKey, error) {
var key *rsa.PrivateKey
block, _ := pem.Decode(privateKey)
enc := x509.IsEncryptedPEMBlock(block)
b := block.Bytes
Expand All @@ -462,10 +463,16 @@ func bytesToPrivateKey(privateKey []byte) (*rsa.PrivateKey, error) {
return nil, err
}
}
key, err := x509.ParsePKCS1PrivateKey(b)
pkcs1Key, err := x509.ParsePKCS1PrivateKey(b)
if err != nil {
log.Error(err)
return nil, err
pkcs8Key, err := x509.ParsePKCS8PrivateKey(b)
if err != nil {
log.Error(err)
return nil, err
}
key = pkcs8Key.(*rsa.PrivateKey)
} else {
key = pkcs1Key
}
return key, nil
}
2 changes: 1 addition & 1 deletion install/Docker/dockerfiles/Dockerfile.aciplugin
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN go build -i .
COPY install/Docker/dockerfiles/scripts/add-hosts .
RUN go build -o add-hosts add-hosts.go

FROM ubuntu:20.04
FROM ubuntu:22.04

ARG ODIMRA_USER_ID
ARG ODIMRA_GROUP_ID
Expand Down

0 comments on commit 1f03376

Please sign in to comment.