Git Product home page Git Product logo

katello-client-bootstrap's Introduction

Katello

Build Status Code Climate

Full documentation is at https://www.theforeman.org/plugins/katello/

About

Katello is a systems life cycle management plugin to Foreman. Katello allows you to manage thousands of machines with one click. Katello can pull content from remote repositories into isolated environments, and make subscriptions management a breeze.

Currently, it is able to handle Fedora and Red Hat Enterprise Linux based systems.

Development

The most common way to set up Katello for development is to use forklift. This will set up a virtual machine with the Katello codebase checked out. Please use the forklift documentation found in the repository for how to get started with forklift.

If you have questions about or issues with deploying a development environment, feel free to ask for assistance in #theforeman-dev IRC channel on libera.chat or via the community forum

Test Run

At this point, the development environment should be completely setup and the Katello engine functionality available. To verify this, go to your Foreman checkout:

  1. Start the development server

    cd $GITDIR/foreman
    
    bundle exec foreman start
  2. Access Foreman in your browser (e.g. https://<hostname>/). Note that while Rails will listen on port 3000, the dev installer will set up a reverse proxy so HTTPS on port 443 will work.

  3. The first time you do this, you will need to accept the self-signed certificate on port 3808 by first visiting https://<hostname>:3808

  4. Login to Foreman (default: admin and changeme)

  5. If you go to https://<hostname>/about and view the "Plugins" tab, you should see a "Katello" plugin listed.

Reset Development Environment

In order to reset the development environment, all backend data and the database needs to be reset. To reiterate, the following will destroy all data in Pulp, Candlepin and your Foreman/Katello database. From the Foreman checkout run:

rake katello:reset

Found a bug?

That's rather unfortunate. But don't worry! We can help. Just file a bug in our project tracker.

Contributing

See the developer documentation.

Annotated Pulp and Candlepin Workflows and test Scenarios

See the annotation docs for more information.

Contact & Resources

Documentation

Most of our documentation (both for users and developers) can be found at theforeman.org.

katello-client-bootstrap's People

Contributors

ahumbe avatar alosadagrande avatar bergsjoh avatar d-kaylor avatar dependabot[bot] avatar dlobatog avatar ehelms avatar ekohl avatar ericzolf avatar evgeni avatar faust64 avatar fcami avatar jeis2497052 avatar josephpisciotta avatar lzap avatar mccun934 avatar ogajduse avatar olardit-sg avatar opuk avatar peppos avatar pizarrog avatar rocco83 avatar rplevka avatar sbernhard avatar sideangleside avatar stbenjam avatar swadeley avatar tchellomello avatar vagnerfarias avatar wzzrd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

katello-client-bootstrap's Issues

Can Delete Virtual Machine during Re-registration attempts

For Red Hatters please see:
CASE 01600399
bootstrap.py deletes virtual machine

I ran the script to attempt to "re-register" a system with the --force option. Apparently, it will remove the old host entry (as it should). However, this does not simply remove the entry, if your satellite is communicating properly with vsphere, it will also delete the etire virtual machine from vsphere. This may be more of a function of the way sat handles removal requests then an issue with the script. I will try to update this when/if GSS responds.

[RUNNING], [2016-03-14 16:46:48], [Deleting host id 4 for host HOST]

organization not found would not lead to error

Hi,

Satellite 6.1.
See below for a traceback. My error was taking label of the organization and not the name (maybe lack of documentation is another bug), but nevertheless, myorgid = none should stop the script imo.

Important thing:
ORG - Default_Organization
myorgid: None

usgnutllab11 ~ # ./bootstrap.py -l admin -p redhat -s fqdn -o Default_Organization -L mylocation -g RHEL6 -a RHEL6_Test_ActivationKey -v
HOSTNAME - testhost.fqdn
MAC - 005056bc582c
SAT6_FQDN - sthost.fqdn
LOGIN - admin
PASSWORD - redhat
HOSTGROUP - RHEL6
LOCATION - mylocation
ORG - Default_Organization
ACTIVATIONKEY - RHEL6_Test_ActivationKey
Satellite 6 Bootstrap Script
This script is designed to register new systems or to migrate an existing system to Red Hat Satellite 6

[NOTIFICATION], [2015-12-14 15:20:06], [This system is not registered to RHN. Attempting to register via subscription-manager]

myhgid: 2
mylocid: 3
myorgid: None

MAC: 005056bc582c

Traceback (most recent call last):
File "./bootstrap.py", line 289, in
create_host()
File "./bootstrap.py", line 263, in create_host
jsondata = json.loads('{"host": {"name": "%s","hostgroup_id": %s,"organization_id": %s,"location_id": %s,"mac":"%s"}}' % (HOSTNAME,myhgid,myorgid,mylocid,MAC))
File "/usr/lib64/python2.6/json/init.py", line 307, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.6/json/decoder.py", line 319, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python2.6/json/decoder.py", line 336, in raw_decode
obj, end = self._scanner.iterscan(s, **kw).next()
File "/usr/lib64/python2.6/json/scanner.py", line 55, in iterscan
rval, next_pos = action(m, context)
File "/usr/lib64/python2.6/json/decoder.py", line 183, in JSONObject
value, end = iterscan(s, idx=end, context=context).next()
File "/usr/lib64/python2.6/json/scanner.py", line 55, in iterscan
rval, next_pos = action(m, context)
File "/usr/lib64/python2.6/json/decoder.py", line 185, in JSONObject
raise ValueError(errmsg("Expecting object", s, end))
ValueError: Expecting object: line 1 column 97 (char 97)
usgnutllab11 ~ #

RHEL5 support

Hi,

I am testing finally the script on some RHEL5, python 2.4.

Got, up to now, the following problems:

In order to get the version and understand which code to be run, in example for platform.linuxdistribution,
https://docs.python.org/2/library/sys.html#sys.hexversion
or
http://stackoverflow.com/questions/1093322/how-do-i-check-what-version-of-python-is-running-my-script

patch coming soon, this has been not tested deeply.

systemctl / chkconfig

In install_katello_agent and install_puppet_agent bootstrap is using chkconfig.

In some cases (where you might run automation, with non-full environments etc) you will end up with errors due to chkconfig redirection to systemctl on RHEL7 doesn't work.

Proposed fix: Run systemctl commands for rhel7, chkconfig for < rhel7.

force non-migration codepath while systemdid is present

there are hosts that have a systemid file, but are not really regged to sat5
rhn-channel -l will take 30 seconds (timeout) to recognize that and go to the register path

maybe we should add --force-new-registration that skips the systemdid check at all and calls the rhn_cleanup?

handling hostgroups without operating system and fields dependant on this field

Hi,

I didn't ever faced the problem because of this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1306925

The problem is that

  • host[architecture_id](already fixed)
    optional , nil allowed
    required if host is managed and value is not inherited from host group
  • host[operatingsystem_id]
    optional , nil allowed
    required if host is managed and value is not inherited from host group
  • host[medium_id]
    optional , nil allowed
    required if not imaged based provisioning and host is managed and value is not inherited from host group

Must be passed to API in order to not have a failure on the script.
I have already started writing the patch, creating the needed functions.

for post_json there are 2 ways to solve it, imo:

  1. usage of json.append for each value not null
  2. always filling json with optional data.

In option 2 i have not found how to do it properly.
passing null value in json will return error.

Any hint or suggestion on how to proceed?

Thanks,
Daniele

get_bootstrap_rpm doesn't die in case if remote package doesn't exist

get_bootstrap_rpm calls exec_failexit on yum localinstall but due to way yum handles responses, it does not catch the failure in download of the package:

> yum -y localinstall http://completely.fictive.hostname/foo.rpm --nogpgcheck
Loaded plugins: product-id, security, subscription-manager
Setting up Local Package Process
Cannot open: http://completely.fictive.hostname/foo.rpm. Skipping.
Nothing to do
> echo $?
0
  • so it evaluates this situation as a success and continues.

Fails on nested hostgroups with same name

If there's more than one hostgroup with the same name but different parent it will try to use the parent hostgroup.

Example:
RHEL7/common
RHEL6/common

Script will try to use RHEL7 or RHEL6 instead.

[RFE] Always pass --force to rhn-migrate-classic-to-rhsm

in the migrate_systems() function, we call rhn-migrate-classic-to-rhsm to migrate systems from Classic to Sat6. By default, the rhn-migrate-classic-to-rhsm script fails if the user has custom channels defined.


[ERROR], [2016-11-17 14:30:45], EXITING: [/usr/sbin/rhn-migrate-classic-to-rhsm --org Customer --activation-key 'My_AK'  --destination-url=https://satellite6.example.com:443/rhsm --keep] failed to execute properly.

Use --force to ignore these channels and continue the migration.

Retrieving existing legacy subscription information...
+-----------------------------------------------------+
System is currently subscribed to these legacy channels:
+-----------------------------------------------------+
rhel-x86_64-server-6
customer_el6
rhn-tools-rhel-x86_64-server-6

+-----------------------------------------------------+
No product certificates are mapped to these legacy channels:
+-----------------------------------------------------+
customer_el6

We should always pass --force to rhn-migrate. The manual states:

      -f, --force
              Ignore  channels not available through Customer Portal Subscription Management (or Subscription Asset Manager). The channels in
              Red Hat Network Classic are mapped to the product certificates used by the Customer Portal  Subscription  Management.  However,
              not  every  channel  has  a  certificate mapping, which can cause errors during migration. Using this option skips any channels
              which are not mapped to Customer Portal Subscription Management.

I see no downside to doing this. Of course we can't install product certificates for custom channels. No need to bail here. Thoughts?

loose the hardcoded error message as it produces confusing errors

Perhaps the following lines of code should be dropped:
https://github.com/Katello/client-bootstrap/blob/master/bootstrap.py#L241-#L242
as they provide confusing output if the root cause is completely different from 'connecting to API':

e.g.:

[RUNNING], [2016-04-05 14:29:38], [Calling Satellite API to create a host entry associated with the group, org & location] 
Error: cannot connect to the API: HTTP Error 422: Unprocessable Entity
Check your URL & try to login using the same user/pass via the WebUI and check the error!
error: {
  "error": {"id":null,"errors":{"name":["has already been taken"],"mac":["has already been taken"]},"full_messages":["Name has already been taken","MAC address has already been taken"]}
}

Unable to call the script with OS having a space in the title

bootstrap script currently uses a title field of os entity in the API call in order to get the needed os.
However, the title of the os in katello is constructed from OS name and major version joined with a space (e.g. Centos 7).
Since the space is not being urlencoded, the resulting api call will fail to find the correct OS and whole script fails.

get_bootstrap_rpm() exits in case the ca-consumer package already installed

After addressing #50 we exit the bootstrap script on finding out the package is already installed

[RUNNING], [2016-07-20 18:02:17], [rpm -Uvh http://my-katello.com/pub/katello-ca-consumer-latest.noarch.rpm] 
[ERROR], [2016-07-20 18:02:17], EXITING: [rpm -Uvh http://my-katello.com/pub/katello-ca-consumer-latest.noarch.rpm] failed to execute properly.
Retrieving http://my-katello.com/pub/katello-ca-consumer-latest.noarch.rpm
Preparing...                          ########################################
    package katello-ca-consumer-my-katello.com-1.0-1.noarch is already installed

We can replace the installed package easily by adding --replacepkgs to the rpm command, however I won't post a PR until we decide we want this.

Exiting the bootstrap script on finding some version of this package installed might be a wanted behavior - what do you think?

Fails when using nested host groups

Script fails with HTTP error 404 when trying to add a server to a nested host group

Foreman production log:
ActionController::RoutingError (No route matches [GET] "/api/v2/hostgroups/Foo/Bar"):

URL should be /api/v2/hostgroups/:id

[RFE] create_host to succeed even if there is no environment_id attached to Host Group

As the subject says, create_host fails with an error that a null environment_id isn't acceptable.

Adding the following two lines solved the issue for me, but it sounds slightly ugly, because it assumes an ID of 1 for production, and I don't know if there are no side effects if the Puppet environment of the created host is set "forcefully" to production:

    if (return_puppetenv_for_hg(return_matching_foreman_key('hostgroups', 'title="%s"' % options.hostgroup, 'id', False)) == "production"):
        jsondata['host']['environment_id'] = 1 # Assuming production's ID is 1

bootstrap-envid_patch.txt

Does not work with foreman locations disabled

When omitting the -L parameter I get a 404 from API url /api/v2/locations/?search=title%3DDefault_Location

Would be nice to be able to use the script without locations enabled ...

[RFE] Add support for removing RHUI Packages

I want to add support for removing packages that provide access to repositories hosted by RHUI (which is used by various cloud providers, such as Amazon). There are two ways I am thinking of tackling this:

  • Add a new switch (--remove-rhui-packages), which calls 'yum remove rh--rhui-client'
  • refactoring the (-R | --remove-rhn-packages) switch (and associated function), to make a generic (-R | --remove-packages) switch, which removes both the RHN & RHUI packages.

Also, what are your thoughts on defaulting to removing the old RHN & RHUI packages (Today we only remove them if explicitly asked)?

Does not work for me with 6.2

I can't get it working against 6.2 beta. I already noticed there is some confusion between name/title of the organization, so I made some changes myself:

[root@ibm-x3650m4-01-vm-13 ~]# diff bootstrap.py.orig bootstrap.py
317c320
<         print_error("%d element in array for search key %s in API %s. Fatal error." % result_len, search_key, api_name)

---
>         print_error("%d element in array for search key %s in API %s. Fatal error." % (result_len, search_key, api_name))
358,361c361,364
<     myhgid = return_matching_id('hostgroups', 'title=%s' % options.hostgroup, False)
<     mylocid = return_matching_id('locations', 'title=%s' % options.location, False)
<     myorgid = return_matching_id('organizations', 'name=%s' % options.org, False)
<     mydomainid = return_matching_id('domains', 'name=%s' % DOMAIN, False)

---
>     myhgid = return_matching_id('hostgroups', 'name="%s"' % options.hostgroup, False)
>     mylocid = return_matching_id('locations', 'name="%s"' % options.location, False)
>     myorgid = return_matching_id('organizations', 'label=%s' % options.org, False)
>     mydomainid = return_matching_id('domains', 'name="%s"' % DOMAIN, False)

But then:

Error: cannot connect to the API: HTTP Error 404: Not Found
Check your URL & try to login using the same user/pass via the WebUI and check the error!
error: {
  "error": {"message":"Resource organization not found by id 'Default_Organization'"}
}

The URL that is causing issues is:

https://rhsm-qe-3.rhq.lab.eng.bos.redhat.com:443/katello/api/organizations/Default_Organization

When using the --skip-foreman switch we should not prompt for username/pasword.

If I wanted to use bootstrap.py and only register the system for content via katello, I'd want to issue

bootstrap.py --skip-foreman -a My_Activation_Key -o My_Org -s satellite.example.com.

However, this command prompts me for password.
As newer Katello versions (3.0+) have Unified Hosts, we no longer need to create the host in Foreman so that the host / content-host entry are properly linked.

We'd still need to create the host when setting up a host to be properly managed via Puppet.

Having this capability makes it easier for users who are 'content-only' to get up and running, and would give them a better experience than just running 'subscription-manager register'

Note: for older versions of Katello (<2.4) we'd still need to prompt for username/password to precreate the Host entry.

Error creating the host against Katello 3.3 RC1

Gives an error while creating the host against Katello 3.3 RC1:

# ./bootstrap.py -l admin -s katello.example.com -o 'Default_Organization' -L 'Default_Location' -g ServersHostGroup -a servers-ak

Gives this error:

[RUNNING], [2017-01-14 03:00:14], [Calling Foreman API to create a host entry associated with the group & org] 
An error occured: HTTP Error 500: Internal Server Error
url: https://katello.example.com:443/api/v2/hosts/
code: 500
data: {
  "host": {
    "managed": "true", 
    "name": "server1", 
    "hostgroup_id": 1, 
    "organization_id": 1, 
    "mac": "52:54:55:55:55:55", 
    "architecture_id": 1, 
    "location_id": 2, 
    "domain_id": 1
  }
}
error: {
  "error": {
    "message": "ActiveModel::ForbiddenAttributesError"
  }
}

Did the API change in 3.3?

Not real hostname are used

When in my /etc/hosts exist many entries with same ip, the bootstrap.py use the first entry and not a real hostname and domain from "hostname -f". I saw that part of the script that values the variables is this:

FQDN = socket.getfqdn()
    if FQDN.find(".") != -1:
        HOSTNAME = FQDN.split('.')[0]
        DOMAIN = FQDN[FQDN.index('.') + 1:]
    else:
        HOSTNAME = FQDN
        DOMAIN = None

Is possible to change this for use a real hostname from hostname -f for example?

[RFE] check for updates

it would be nice if bootstrap.py could check if http(s)?://<katello_fqdn>/pub/bootstrap.py is a newer version and download it.

idea by @bergsjoh

Creation of /etc/rhsm/facts/katello.facts fails on systems that do not have subscription-manager installed

On older systems that do not have subscription-manager (or on systems where the admin never installed it), the creation of /etc/rhsm/facts/katello.facts fails with a traceback similar to the following:

Traceback (most recent call last):
  File "./bootstrap.py.orig", line 797, in <module>
    clean_environment()
  File "./bootstrap.py.orig", line 277, in clean_environment
    katellofacts = open('/etc/rhsm/facts/katello.facts', 'w')
IOError: [Errno 2] No such file or directory: '/etc/rhsm/facts/katello.facts'

This is because /etc/rhsm/facts is created (and owned) by the subscription-manager package and doesn't exist until after the package is installed.

We can address this one of two ways.

  • run the pythonic equivalent of mkdir -p /etc/rhsm/facts in the clean_environment function.
  • move the code that creates /etc/rhsm/facts/katello.facts to run after subscription-manager is installed in the install_prereqs function.

See also RH BZ1408972

Make usage of a more generic function

Based on #44 and #49 (comment)
the current function
return_matching_id(api_name, search_key, null_result_ok=False):
should became something like
return_matching_key(api_name, search_key, null_result_ok=False, return_key="id"):

Following functions should became useless:
https://github.com/Katello/client-bootstrap/blob/master/bootstrap.py#L321
https://github.com/Katello/client-bootstrap/blob/master/bootstrap.py#L333
https://github.com/Katello/client-bootstrap/blob/master/bootstrap.py#L347

Anyone willing to check if there anything else impacted is more than welcome :)

This script seems very broken for Satellite 6.1

Satellite 6.1 returns the following error to the "Create Host" API call:

{
    "error": {
        "id": null,
        "errors": {
            "environment_id": [
                "can't be blank"
            ],
            "architecture_id": [
                "can't be blank"
            ],
            "operatingsystem_id": [
                "can't be blank"
            ],
            "domain_id": [
                "can't be blank"
            ],
            "root_pass": [
                "should be 8 characters or more",
                "should not be blank - consider setting a global or host group default"
            ],
            "ptable_id": [
                "can't be blank unless a custom partition has been defined"
            ]
        },
        "full_messages": [
            "Environment can't be blank",
            "Architecture can't be blank",
            "Operatingsystem can't be blank",
            "Domain can't be blank",
            "Root password should be 8 characters or more",
            "Root password should not be blank - consider setting a global or host group default",
            "Partition Table can't be blank unless a custom partition has been defined"
        ]
    }
}

Since some of these params are not present in the Satellite 6.0 API Guide, it's my assumption that they were added in 6.1 (though I can't confirm this as Red Hat's 6.1 API Guide appears incomplete/broken.

This also seems related to this Red Hat bug: https://bugzilla.redhat.com/show_bug.cgi?id=1135651

does not work on i386

ARCHITECTURE is either x86 or x86_64 but the archs are called i386 and x86_64โ€ฆ

spotted while reviewing @lzap's code

Refactoring of try/catch for API call

keep connection open to API

There are currently several call to katello/foreman API, and, in my understanding, every call is asking for a new authentication.
It would be a good improvement to have one initial "login", perform operations, and "logout" at the end of the script.
In example, in case of LDAP connection Foreman/Katello give sometimes 500 error in authentication.
This can be a workaround.

What do you think about it?
Do you have any suggestion on how to handle the 1st time auth with Katello/Foreman API?
I can for sure work on the PR.

Satellite complains about blank IP during host entry creation

Hello,

I'm trying your script to add existing servers into our Satellite (6.2.5).
I have an issue, as the script fails at the host entry creation as Satellite complains about blank ip.
Please note that we use static IPs for servers, so no dhcp.

[...]
[RUNNING], [2017-01-04 17:20:21], [Calling Foreman API to create a host entry associated with the group & org]
url: https://xxxxx:443/api/v2/hosts/
method: POST
data: {
  "host": {
    "managed": "true",
    "name": "server1",
    "hostgroup_id": 8,
    "organization_id": 1,
    "mac": "xx:xx:xx:xx:xx:xx",
    "architecture_id": 1,
    "location_id": 2,
    "domain_id": 1
  }
}
An error occured: HTTP Error 422: Unprocessable Entity
url: https://xxxxx6:443/api/v2/hosts/
code: 422
data: {
  "host": {
    "managed": "true",
    "name": "server1",
    "hostgroup_id": 8,
    "organization_id": 1,
    "mac": "xx:xx:xx:xx:xx:xx",
    "architecture_id": 1,
    "location_id": 2,
    "domain_id": 1
  }
}
error: {
  "error": {
    "errors": {
      "interfaces.ip": [
        "can't be blank"
      ]
    },
    "id": null,
    "full_messages": [
      "Ip can't be blank"
    ]
  }
}

BR,
Yannick

get id - redundant functions

Hi,

there is a lot of functions with the same scope: getting ids from satellite.

my suggestion (proof of concept):

def return_matching_id(api_name, search_key, null_result_ok):
    myurl = "https://" + options.sat6_fqdn + ":" + API_PORT + "/api/v2/" + api_name  + "/?" + urlencode([('search', '' + str(search_key))])
    if options.verbose:
        print myurl
    return_values = get_json(myurl)
    if options.verbose:
        print json.dumps(result_len, sort_keys = False, indent = 2)
    result_len = len(return_values['results'])
    if result_len == 1:
        return_values_id = return_values['results'][0]['id']
        return return_values_id
    elif result_len == 0 and null_result_ok is True:
        return None
    else:
        print_error("%d element in array for search key %s in API %s. Fatal error." % result_len, search_key, api_name)
        sys.exit(2)

Along with (example)
myhgid = return_matching_id('hostgroups', 'title=%s' % options.hostgroup, False)

This is very general and can be used also for (in example) host search, in which 0 result are good.

Any comment, idea, suggestion?

Daniele

Usage through proxy still uses port 443

If you edit the python and set the API_PORT to 8443 (the reverse proxy port on the capsule back to the satellite) it will still make calls via 443. Here is a quick cut/paste of the relevent output.

://MYCAPSULE:443/api/v2/hostgroups/?search=title%3Ddev
request: https://MYCAPSULE:443/api/v2/hostgroups/?search=title%3Ddev
Error: cannot connect to the API: HTTP Error 404: Not Found
Check your URL & try to login using the same user/pass via the WebUI and check the error!
error:

<title>404 Not Found</title>

Not Found

The requested URL /api/v2/hostgroups/ was not found on this server.

url: https://MYCAPSULE:443/api/v2/hostgroups/?search=title%3Ddev

[RFE] Provide bootstrap on capsules via reverse proxy

Keep a single place for the bootstrap.py file. For example if its located in the /usr/share/foreman/public directory, it will be available on capsules as https://:8443/bootstrap.py via the reverse proxy.

This way it doesn't need to be managed and under control on every capsule in the infrastructure.

Works only with local users

I think the call_api needs a local foreman user to work. I got a permission denied error with a freeipa user, although the user had admin privileges.

--legacy-purge

Maybe I'm reading this wrong but this is supposed to remove it from the satellite 5 server correct? We just tried it and it didn't make a api call the sat5 server to remove the host after it registered it with the new sat6 server. Looking at the source, doesn't seem like this has been added to the code yet? Is that right? -Scott

/var/lib/puppet/ssl creation fail

When script run

/usr/bin/puppet agent --test --noop --tags no_such_tag --waitforcert 10

I found this error in rhel 5 and rhel6

err: /File[/root/\/var/lib/puppet/ssl]/ensure: change from absent to directory failed: Cannot create /root/\/var/lib/puppet/ssl; parent directory /root/\/var/lib/puppet does not exist
notice: /File[/root/\/var/lib/puppet/ssl/certs]: Dependency File[/root/\/var/lib/puppet/ssl] has failures: true
warning: /File[/root/\/var/lib/puppet/ssl/certs]: Skipping because of failed dependencies
notice: /File[/root/\/var/lib/puppet/ssl/private_keys]: Dependency File[/root/\/var/lib/puppet/ssl] has failures: true
warning: /File[/root/\/var/lib/puppet/ssl/private_keys]: Skipping because of failed dependencies
notice: /File[/root/\/var/lib/puppet/ssl/certificate_requests]: Dependency File[/root/\/var/lib/puppet/ssl] has failures: true
warning: /File[/root/\/var/lib/puppet/ssl/certificate_requests]: Skipping because of failed dependencies
notice: /File[/root/\/var/lib/puppet/ssl/private]: Dependency File[/root/\/var/lib/puppet/ssl] has failures: true
warning: /File[/root/\/var/lib/puppet/ssl/private]: Skipping because of failed dependencies
notice: /File[/root/\/var/lib/puppet/ssl/public_keys]: Dependency File[/root/\/var/lib/puppet/ssl] has failures: true
warning: /File[/root/\/var/lib/puppet/ssl/public_keys]: Skipping because of failed dependencies
Could not prepare for execution: Got 1 failure(s) while initializing: change from absent to directory failed: Cannot create /root/\/var/lib/puppet/ssl; parent directory /root/\/var/lib/puppet does not exist

I identify the problem in line 224.

ssldir = $vardir/ssl

I change it in

ssldir = $vardir/ssl

and work fine

--rex produces an error

[NOTIFICATION], [2017-02-14 17:02:48], [The server was unable to fulfill the request. Error: 404]
Traceback (most recent call last):
File "./bootstrap.py", line 874, in
install_foreman_ssh_key()
File "./bootstrap.py", line 360, in install_foreman_ssh_key
if foreman_ssh_key in open(foreman_ssh_authfile, 'r').read():
UnboundLocalError: local variable 'foreman_ssh_key' referenced before assignment

Odd issue in return_matching_id...

Greetings all,

Disclaimer would be that this is probably something missing on my RHEL7 (hooking to Sat 6.1) server.

When I run the script, I get through several of the steps and then come out with this error:

[SUCCESS], [2016-04-01 13:56:45], [/usr/bin/yum -y localinstall http://myserver.com/pub/katello-ca-consumer-latest.noarch.rpm --nogpgcheck], completed successfully.

Traceback (most recent call last):
File "./bootstrap.py", line 426, in
create_host()
File "./bootstrap.py", line 360, in create_host
myorgid = return_matching_id('organizations', 'name=%s' % options.org, False)
File "./bootstrap.py", line 317, in return_matching_id
print_error("%d element in array for search key %s in API %s. Fatal error." % result_len, search_key, api_name)
TypeError: not enough arguments for format string

I checked to make sure I have a Host Group setup, and I put the Org in quotes to be safe (tried with an without quotes, the error is the same).

I'm not sure what I'm missing.

Thanks in advance,
MM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.