From a84fc6bde9718850081485f885ac130e27f4823a Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Fri, 29 Mar 2019 14:24:12 -0700 Subject: [PATCH 1/2] remove default ssh_username from oracle classic builder, but add note in docs. --- builder/oracle/classic/config.go | 4 ---- website/source/docs/builders/oracle-classic.html.md | 8 +++++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/builder/oracle/classic/config.go b/builder/oracle/classic/config.go index 82bbb4225..7809b5259 100644 --- a/builder/oracle/classic/config.go +++ b/builder/oracle/classic/config.go @@ -75,10 +75,6 @@ func NewConfig(raws ...interface{}) (*Config, error) { if c.SSHSourceList == "" { c.SSHSourceList = "seciplist:/oracle/public/public-internet" } - // Use default oracle username with sudo privileges - if c.Comm.SSHUsername == "" { - c.Comm.SSHUsername = "opc" - } if c.SnapshotTimeout == 0 { c.SnapshotTimeout = 20 * time.Minute diff --git a/website/source/docs/builders/oracle-classic.html.md b/website/source/docs/builders/oracle-classic.html.md index 1fef81830..0d64e584a 100644 --- a/website/source/docs/builders/oracle-classic.html.md +++ b/website/source/docs/builders/oracle-classic.html.md @@ -87,9 +87,11 @@ builder. This builder currently only works with the SSH communicator. list. If you don't provide one, Packer will provide a generic description. - `ssh_username` (string) - The username that Packer will use to SSH into the - instance; defaults to `opc`, the default oracle user, which has sudo - privileges. If you have already configured users on your machine, you may - prompt Packer to use one of those instead. For more detail, see the + instance; required if using SSH. The default oracle user with sudo + privileges is `opc`, so you may set `ssh_username` to `opc` if you have not + yet configured users on your machine. If you have already configured users + on your machine, you may prompt Packer to use one of those instead. For + more detail, see the [documentation](https://docs.oracle.com/en/cloud/iaas/compute-iaas-cloud/stcsg/accessing-oracle-linux-instance-using-ssh.html). - `image_name` (string) - The name to assign to the resulting custom image. From b764b1d7e1360d88f6a5f4f2d27ca428f28e2374 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Fri, 29 Mar 2019 15:05:51 -0700 Subject: [PATCH 2/2] fix tests --- builder/oracle/classic/config_test.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/builder/oracle/classic/config_test.go b/builder/oracle/classic/config_test.go index ff6bf2a00..b120e70a3 100644 --- a/builder/oracle/classic/config_test.go +++ b/builder/oracle/classic/config_test.go @@ -42,6 +42,7 @@ func TestConfigValidationCatchesMissing(t *testing.T) { "dest_image_list", "source_image_list", "shape", + "ssh_username", } for _, key := range required { tc := testConfig() @@ -53,15 +54,6 @@ func TestConfigValidationCatchesMissing(t *testing.T) { } } -func TestValidationsIgnoresOptional(t *testing.T) { - tc := testConfig() - delete(tc, "ssh_username") - _, err := NewConfig(tc) - if err != nil { - t.Fatalf("Shouldn't care if ssh_username is missing: err: %#v", err.Error()) - } -} - func TestConfigValidatesObjects(t *testing.T) { var objectTests = []struct { object string