Sorry to ask this again, I recall there being a wa...
# fleet
Sorry to ask this again, I recall there being a way to export policies using the API and then importing them using fleetctl apply. However when I try to do that I get
no spec field on "" document
@Tilman Bender is this resolved yet?
@koo hey unfortunately it is not. I just got sidetracked
Okay I'll see if I can get some answers for you
hi there, could you provide a bit more details: what fleet version are you using, what command and parameters/files are you trying that are giving you that error?
sudo fleetctl --version
fleetctl - version 4.10.0
branch: 	HEAD
revision: 	67827474c22b61a08f112e682b994aa3e9356133
build date: 	2022-02-14
build user: 	runner
go version: 	go1.17.7
Fleet is also 4.10
the file I am trying to apply looks like this:
"policies": [
"id": 1,
"name": "Windows: Remote Assistance disabled",
"query": "SELECT 1 FROM registry WHERE path = 'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Remote Assistance\\fAllowFullControl' AND data=0;",
"description": "Check the Windows regsitry to see if Windows Remote Assistance is disabled",
"author_id": 1,
"author_name": "Tilman Bender",
"author_email": "<|>",
"team_id": null,
"resolution": "PS: \nSet-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Remote Assistance\\' -Name fAllowFullControl –Value 0",
"platform": "",
"created_at": "2022-02-22T17:20:40Z",
"updated_at": "2022-02-23T16:16:57Z",
"passing_host_count": 1,
"failing_host_count": 2
I obtained it using :
curl -H "Authorization: Bearer ${FLEET_TOKEN}" "https://${FLEET_SERVER}/api/v1/fleet/global/policies" -o policies.json
I had read someplace that you can re-import policies using fleetctl (event though you cannot export them yet using fleetctl)
Ah found it again: Issue #4046
Aaand I see my problem. I'd probably have to convert my exported policies to the correct yaml
that is correct, the apply command accepts yaml
Okay, managed to get it working
👍 1
This one is solved. Use API to export, then transform the resulting JSON into a YAML that
fleetctl apply
understands. Details can also be found in issue 4046