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

fpt syntax check isn't giving me enough information to find error #30

Open
mdlopresti opened this issue Jan 21, 2021 · 5 comments
Open

Comments

@mdlopresti
Copy link

mdlopresti commented Jan 21, 2021

When running the fpt command to check syntax of a policy template it is telling me there is a syntax error, but it doesn't say where. Also when uploading to the flexera goverance page, I don't get a syntax error and I can execute the template. Below is my output.

fpt check ./azure_tag_missing_sysid_all.rb --debug
Checking ./azure_tag_missing_sysid_all.rb
An unexpected error occurred: missing token
ERROR: compilation errors occurred

Attached is the Dockerfile that defines the dev enviroment I am working in and a sanitized version policy I am trying to check, for ease of replicating the error.

My end goal is to use FPT for a CI process tool and if possible a linter in vscode.

things to recreate my error.zip

@douglaswth
Copy link
Contributor

What version of fpt are you using? With the latest version (v1.2.2), I am getting this:

Checking .\azure_tag_missing_sysid.rb
1 syntax error found:
  origin: template: azure_tag_missing_sysid.rb, line: 336
  problem: Syntax error
  summary: unexpected end-of-input, expecting keyword_end.
  resolution: Use valid Policy Template syntax. More information at http://docs.rightscale.com/policies/reference/v20180301/policy_template_language.html#syntax

ERROR: compilation errors occurred

Looking at the source I figured out that there was a missing end on your policy block:

@@ -219,6 +219,7 @@
         end
     end
   end
+end

 ###########################################################################################################################################################
 # Escalation

With that change, it looks like your policy is accepted by fpt check.

@mdlopresti
Copy link
Author

After checking it looks like (v1.2.2), each time the container restarts it is downloading it from https://binaries.rightscale.com/rsbin/fpt/v1/fpt-linux-amd64.tgz

fpt -v
fpt v1.2.2 - 2021-01-15 19:59:42 - 756b1e0749b6458539d13945098deebe0c0dfe68

From your slashes are you using the windows version?

@douglaswth
Copy link
Contributor

I have tested it on both the Linux and Windows versions and get the same results that I mentioned on both.

@douglaswth
Copy link
Contributor

Looking at where the "An unexpected error occurred:" error comes from, it looks like it is probably getting something unexpected back from the Policies system rather than being something wrong with fpt itself.

https://github.com/rightscale/policy_sdk/blob/master/cmd/fpt/check.go#L61

It might make sense to contact support about this issue.

@mdlopresti
Copy link
Author

I was on a call last night before hoping off for the day with @rshade and he was telling me the same thing. I'm going to polish up a way of easily reproducing the issue, then contact support.

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