Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not get terrascan init to work - would not download policy documents #551

Closed
swails opened this issue Feb 16, 2021 · 6 comments
Closed
Assignees

Comments

@swails
Copy link

swails commented Feb 16, 2021

  • terrascan version: 1.3.2
  • Operating System: Linux x86-64

Description

I could not initialize terrascan after first downloading it

What I Did

$ wget https://github.com/accurics/terrascan/releases/download/v1.3.2/terrascan_1.3.2_Linux_x86_64.tar.gz
$ tar zxvf terrascan_1.3.2_Linux_x86_64.tar terrascan
$ mv terrascan /usr/local/bin
$ terrascan init -l debug
2021-02-16T14:50:55.754-0500	debug	config/global.go:59	global config env variable is not specified
2021-02-16T14:50:55.754-0500	debug	initialize/run.go:41	initializing terrascan
2021-02-16T14:50:55.755-0500	error	initialize/run.go:69	failed to download policies. error: 'repository already exists'
2021-02-16T14:50:55.755-0500	error	cli/init.go:42	failed to initialize terrascan

I couldn't find any documentation that gave me an ideas of what to try next...

@devang-gaur devang-gaur self-assigned this Feb 16, 2021
@devang-gaur
Copy link
Contributor

Hello @swails , could you look for a terrascan folder inside the /tmp path or $TMPDIR path ? When found, please detete that terrascan directory and try again? Please report the result back here.

It seems the repository was cloned in the tmp location from earlier runs and wasn't removed by the code logic.

@swails
Copy link
Author

swails commented Feb 16, 2021

No dice:

$ rm -fr /tmp/terrascan/
$ terrascan init -l debug
2021-02-16T16:04:45.284-0500	debug	config/global.go:59	global config env variable is not specified
2021-02-16T16:04:45.284-0500	debug	initialize/run.go:41	initializing terrascan
2021-02-16T16:04:47.868-0500	error	cli/init.go:42	failed to initialize terrascan

Although the "repository already exists" error is gone...

@devang-gaur
Copy link
Contributor

Aah, I think the failure is happening at this line now
https://github.com/accurics/terrascan/blob/v1.3.2/pkg/initialize/run.go#L101

this os.Rename( ) method is the golang equivalent of a unix mv command. There might be some trouble with the file permissions.

@devang-gaur
Copy link
Contributor

your working directory is probably write protected

@devang-gaur
Copy link
Contributor

@swails did it work after changing file permissions?

@devang-gaur
Copy link
Contributor

Closing this issue for now as v1.3.3 has been release with a fix. Please re-open it if you still face this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants