diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..63c7c9a1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +## 1.0.3 (August 14, 2019) + +BUG FIXES: +- NVME volumes now mount correctly +- Previously attached volumes are no longer skipped diff --git a/GNUmakefile b/GNUmakefile index a4e9b670..97f0e76a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,5 +1,5 @@ NAME:=goat -VERSION:=$(shell git describe --tags) +VERSION:=$(shell git describe --tags|sed 's/^v//') OS:=linux ARCH:=amd64 GOAT_FILES:=$$(find . -name '*.go' | grep -v vendor) diff --git a/ebs.go b/ebs.go index 5404d18b..6159c43b 100644 --- a/ebs.go +++ b/ebs.go @@ -4,8 +4,8 @@ import ( "fmt" log "github.com/sirupsen/logrus" "os" + "os/exec" "strconv" - "syscall" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" @@ -120,7 +120,8 @@ func prepAndMountDrives(volName string, vols []EbsVol) { } driveLogger.Info("Now mounting") - if err := syscall.Mount("", mountPath, "", 0, ""); err != nil { + cmd := exec.Command("mount", mountPath) + if err := cmd.Run(); err != nil { driveLogger.Fatalf("Couldn't mount: %v", err) } diff --git a/ec2.go b/ec2.go index afa4aaef..8c1022bc 100644 --- a/ec2.go +++ b/ec2.go @@ -27,7 +27,9 @@ type EC2Instance struct { //GetEC2InstanceData returns a populated EC2Instance struct with the current EC2 instances' metadata func GetEC2InstanceData(tagPrefix string) EC2Instance { var ec2Instance EC2Instance - sess := session.New() + sess := session.New(&aws.Config{ + MaxRetries: aws.Int(5), +}) creds := credentials.NewCredentials( &ec2rolecreds.EC2RoleProvider{ diff --git a/rpm/goat.cfg b/rpm/goat.cfg new file mode 100644 index 00000000..e8431cc0 --- /dev/null +++ b/rpm/goat.cfg @@ -0,0 +1,2 @@ +TAG_PREFIX=GOAT-IN +LOG_LEVEL=info diff --git a/rpm/goat@.service b/rpm/goat@.service index 62c043ca..10179a2b 100644 --- a/rpm/goat@.service +++ b/rpm/goat@.service @@ -1,16 +1,19 @@ [Unit] Description=GOAT: EC2-%i attach utility Documentation=https://github.com/sevagh/goat -Requires=network.target remote-fs.target -After=network.target remote-fs.target +Requires=network.target +After=network.target +After=NetworkManager-wait-online.service +Before=cloud-init.service ConditionPathExists=/usr/sbin/goat [Service] +EnvironmentFile=/etc/sysconfig/goat Type=oneshot User=root Group=root -ExecStart=/usr/sbin/goat "%i" +ExecStart=/usr/sbin/goat -tagPrefix ${TAG_PREFIX} -logLevel ${LOG_LEVEL} "%i" SyslogIdentifier=goat [Install] -WantedBy=multi-user.target +WantedBy=cloud-init.target diff --git a/rpm/specfile.spec b/rpm/specfile.spec index d3ffd5dd..181d7bb9 100644 --- a/rpm/specfile.spec +++ b/rpm/specfile.spec @@ -9,6 +9,7 @@ License: BSD 3-clause URL: https://github.com/sevagh/goat Source0: %{pkgname} Source1: %{pkgname}@.service +Source2: %{pkgname}.cfg Requires: systemd mdadm @@ -25,11 +26,14 @@ Automatically attach AWS resources to a running EC2 instance. %install %{__mkdir} -p %{buildroot}/%{_sbindir} %{__mkdir} -p %{buildroot}/%{_unitdir} +%{__mkdir} -p %{buildroot}/%{_sysconfdir}/sysconfig %{__install} -m0775 %{SOURCE0} %{buildroot}/%{_sbindir}/%{pkgname} -%{__install} -m0777 %{SOURCE1} %{buildroot}/%{_unitdir}/%{pkgname}@.service +%{__install} -m0644 %{SOURCE1} %{buildroot}/%{_unitdir}/%{pkgname}@.service +%{__install} -m0644 %{SOURCE2} %{buildroot}/%{_sysconfdir}/sysconfig/%{pkgname} %files +%config(noreplace) /etc/sysconfig/goat %{_sbindir}/%{pkgname} %{_unitdir}/%{pkgname}@.service @@ -53,6 +57,8 @@ fi %changelog +* Wed Sep 25 2019 Andrew Cutler +- Add configuration file * Tue Apr 17 2018 Sevag Hanssian - Recombine commands * Tue Mar 06 2018 Sevag Hanssian @@ -60,4 +66,4 @@ fi * Thu Aug 10 2017 Sevag Hanssian - Goat subcommands * Tue Jul 11 2017 Sevag Hanssian -- First RPM package for goat +- First RPM package for goat