Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Commit

Permalink
Remove useless functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tczekajlo committed Oct 12, 2021
1 parent 9b28017 commit c36daca
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 51 deletions.
5 changes: 0 additions & 5 deletions pkg/helm/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,6 @@ func (h *Helm) Install() error {
)
h.Log.V(1).Info("Merging values", "result", h.Values)

// Add host to /etc/hosts - required sudo
//if err := utils.AddHostToEtcHosts(host, ip); err != nil {
// return err
//}
//h.Log.V(1).Info("Adding host", "host", host, "ip", ip)
} else if h.KubernetesBackendType == types.KubernetesBackendLocal &&
h.CloudProvider.Name != types.CloudProviderUnknown {
h.Values = utils.MergeMaps(valuesNginxNodePort(), h.Values)
Expand Down
11 changes: 0 additions & 11 deletions pkg/rasactl/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,6 @@ func (r *RasaCtl) Delete() error {
}
}

/*if r.KubernetesClient.GetBackendType() == types.KubernetesBackendLocal && r.CloudProvider.Name == types.CloudProviderUnknown {
host := fmt.Sprintf("%s.%s", r.Namespace, types.RasaCtlLocalDomain)
r.Log.V(1).Info("Deleting a hostname from /etc/hosts", "host", host)
err := utils.DeleteHostToEtcHosts(host)
if err != nil && !force {
return err
}
}*/

if prune {
r.Log.Info("Deleting namespace", "namespace", r.Namespace)
if err := r.KubernetesClient.DeleteNamespace(); err != nil && !force {
Expand Down
35 changes: 0 additions & 35 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"github.com/imdario/mergo"
"github.com/pkg/errors"
"github.com/spf13/viper"
"github.com/txn2/txeh"
"golang.org/x/term"

"github.com/RasaHQ/rasactl/pkg/types"
Expand Down Expand Up @@ -78,40 +77,6 @@ func MergeMaps(maps ...map[string]interface{}) map[string]interface{} {
return result
}

// AddHostToEtcHosts adds a host with a given IP address to /etc/hosts,
// for Windows it is C:\Windows\System32\Drivers\etc\hosts.
func AddHostToEtcHosts(host, ip string) error {
hosts, err := txeh.NewHostsDefault()
if err != nil {
return err
}

hosts.AddHost(ip, host)

if err := hosts.Save(); err != nil {
return errors.Errorf("Can't add a host, try to run the command as administrator, error: %s", err)
}

return nil
}

// DeleteHostToEtcHosts removes a host from /etc/hosts (linux, darwin), or
// C:\Windows\System32\Drivers\etc\hosts (Windows).
func DeleteHostToEtcHosts(host string) error {
hosts, err := txeh.NewHostsDefault()
if err != nil {
return err
}

hosts.RemoveHost(host)

if err := hosts.Save(); err != nil {
return errors.Errorf("Can't remove a host, try to run the command as administrator, error: %s", err)
}

return nil
}

func ValidateName(name string) error {

if !validName.MatchString(name) {
Expand Down

0 comments on commit c36daca

Please sign in to comment.