Hi there, 

I've recently upgraded my Foreman 1.10 -> 1.11.4 . Since that time we 
cannot create hosts using API/hammer anymore with non-admin user.
My POST. Architecture, etc are inherited from the hostgroup
[ INFO 2017-08-23 13:39:11 API] POST /api/hosts
[DEBUG 2017-08-23 13:39:11 API] Params: {
    "host" => {
                              "name" => "testserver01",
                       "location_id" => 6,
                                "ip" => "192.168.0.5",
                               "mac" => "00:26:27:28:29:FF",
                "operatingsystem_id" => 65,
                         "subnet_id" => 1686,
                      "hostgroup_id" => 2,
                             "build" => false,
                           "enabled" => true,
                           "managed" => true,
                "compute_attributes" => {
            "volumes_attributes" => {}
        },
                         "overwrite" => true,
        "host_parameters_attributes" => {},
             "interfaces_attributes" => {}
    }
}

Response:
[DEBUG 2017-08-23 13:39:53 API] 422 Unprocessable Entity
{
    "error" => {
                   "id" => nil,
               "errors" => {
                            "base" => [
                [0] "No PXELinux templates were found for this host, make 
sure you define at least one in your Redhat 6.9 settings"
            ],
               "interfaces.domain" => [
                [0] "can't be blank"
            ],
            "interfaces.domain_id" => [
                [0] "can't find domain with this id"
            ],
                 "interfaces.base" => [
                [0] "No PXELinux templates were found for this host, make 
sure you define at least one in your Redhat 6.9 settings"
            ],
                 "architecture_id" => [
                [0] "can't be blank"
            ],
                        "conflict" => [],
             "interfaces.conflict" => []
        },
        "full_messages" => [
            [0] "No PXELinux templates were found for this host, make sure 
you define at least one in your Redhat 6.9 settings",
            [1] "Domain can't be blank",
            [2] "Interfaces.domain can't find domain with this id",
            [3] "Base No PXELinux templates were found for this host, make 
sure you define at least one in your Redhat 6.9 settings",
            [4] "Architecture can't be blank"
        ]
    }
}

Those parameters are available in a hostgroup.
At the same time it works okay with the admin user. Everything was okay in 
1.10 with non-admin.
No error messages in the foreman log.

I tried to change permissions in roles, but even after adding of all 
possible items it still doesn't work with the same error.
It can only be fixed by making API user as Admin, which is a unsecure.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-users+unsubscr...@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to